<template>
  <div class="Ticketdetails" id="Ticketdetails">
    <crumbs :BreadCrumb="BreadCrumb"></crumbs>
    <div class="header-1">
      <div class="one" v-if="type !== 'change'">
        <div>
          <!-- 会员信息 -->
          <div class="seven">
            <div class="tuo">
              <div class="tuo-2"></div>
              <span>会员信息</span>
            </div>
            <el-form
              size="mini"
              :inline="true"
              :data="Querydata"
              class="others"
              ref="memberData"
            >
              <div class="Query_c">
                <el-form-item
                  label="手机号"
                  label-width="80px"
                  prop="phoneOne"
                >
                  <el-input
                    size="mini"
                    v-model="Querydata.phoneOne"
                    maxlength="11"
                  ></el-input>
                </el-form-item>
                <el-form-item label="会员卡号" label-width="80px">
                  <el-input size="mini" v-model="Querydata.cardCode"></el-input>
                </el-form-item>
                <el-form-item label-width="80px">
                  <el-button
                    @click="getqueryCustomer"
                    size="mini"
                    type="success"
                    >查询会员
                  </el-button>
                  <el-button
                    @click="registerMethod()"
                    size="mini"
                    type="primary"
                    >注册
                  </el-button>
                </el-form-item>
              </div>
              <el-descriptions v-if="memberData.customerId">
                <el-descriptions-item label="姓名"
                  >{{ memberData.userName || "暂无姓名" }}
                </el-descriptions-item>
                <el-descriptions-item v-if="memberData.phoneOne" label="手机号"
                  >{{ memberData.phoneOne }}
                </el-descriptions-item>
                <el-descriptions-item label="会员卡号" v-if="memberData.cardInfo.cardNumber">{{
                  memberData.cardInfo.cardNumber
                }}</el-descriptions-item>
                <el-descriptions-item label="会员名称" v-if="memberData.cardInfo.cardName">{{
                  memberData.cardInfo.cardName
                }}</el-descriptions-item>
                <el-descriptions-item v-if="memberData.passenInfo && memberData.passenInfo.certificateType" label="证件类型">
                  {{memberData.passenInfo.certificateType | certificateValue}}
                </el-descriptions-item>
                <el-descriptions-item
                  v-if="memberData.passenInfo && memberData.passenInfo.certificateNumber"
                  label="证件号"
                  >{{ memberData.passenInfo.certificateNumber }}
                </el-descriptions-item>
                <el-descriptions-item label="备注">{{
                  memberData.remark? memberData.remark : '暂无'
                }}</el-descriptions-item>
              </el-descriptions>
            </el-form>
          </div>
          <!-- 乘机人员 -->
          <div class="seven">
            <div class="tuo">
              <div class="tuo-2"></div>
              <span>乘机人员</span>
              <div class="three-2" style="color: #abb9c2">
                <span style="text-decoration: underline"
                  >最多
                  <span
                    v-if="cabinLeftDesc == '座位充足'"
                    style="color: #ff0000"
                    >9</span
                  ><span
                    v-if="cabinLeftDesc != '座位充足'"
                    style="color: #ff0000"
                    >{{ cabinLeftDesc }}</span
                  >人</span
                >
                注:建议完善好乘客证件和生日数据，最进行附加产品的选择，保存订单前请根据勾选产品和右侧产品数量仔细检查核对。
              </div>
            </div>
            <div class="others">
              <el-form
                size="mini"
                :inline="true"
                :data="Frequenflyer"
                class="others"
              >
                <div class="three-3">
                  <!-- 添加旅客弹窗 -->
                  <!-- <div class="box1" v-if="showBox"> -->
                  <div
                    class="box1"
                    v-for="(item, index) in userList"
                    :key="(item, index)"
                  >
                    <div>
                      <el-button
                        class="passengers_1"
                        type="danger"
                        icon="el-icon-delete"
                        circle
                        size="mini"
                        @click="handelDelet(item, index)"
                      ></el-button>
                    </div>
                    <div class="passengers">
                      <el-form :inline="true">
                        <!-- ZGJMSFZ <el-form :inline="true" :model="chooseList"> -->
                        <div class="form_ch">
                          <div class="ch_top">
                            <el-form-item label="姓名" label-width="80px">
                              <el-input
                                style="width: 130px"
                                v-model="item.passName"
                                @change="passNameChange(index)"
                                placeholder="请输入姓名"
                              ></el-input>
                            </el-form-item>
                            <el-form-item label="证件类型" label-width="80px">
                              <el-select
                                style="width: 190px"
                                v-model="item.certificateType"
                                placeholder="请选择证件类型"
                                clearable
                                @change="certificateTypeChange(index)"
                              >
                                <el-option
                                  v-for="item in certificate"
                                  :key="item.value + Math.random()"
                                  :label="item.label"
                                  :value="item.value"
                                ></el-option>
                              </el-select>
                            </el-form-item>
                            <el-form-item 
                                v-if="chooseSexInpStatus[index]" label="性别" label-width="40px">
                              <el-select
                                style="width: 100px"
                                v-model="item.passSex"
                                placeholder="请选择"
                                clearable
                              >
                                <el-option label="男" value="male"></el-option>
                                <el-option
                                  label="女"
                                  value="female"
                                ></el-option>
                              </el-select>
                            </el-form-item>
                          </div>
                          <div class="ch_top">
                            <el-form-item label="手机号码" label-width="80px">
                              <el-input
                                style="width: 130px"
                                v-model="item.passPhone"
                                placeholder="请输入手机号码"
                              >
                              </el-input>
                            </el-form-item>
                            <el-form-item label="证件号码" label-width="80px">
                              <el-input
                                style="width: 190px"
                                v-model="item.certificateNumber"
                                placeholder="请输入证件号码"
                                @input="certificateNumcerChange(index)"
                              >
                              </el-input>
                            </el-form-item>
                            <el-form-item
                              label="生日"
                              label-width="40px"
                              v-if="chooseBirthDayStatus[index]"
                            >
                              <el-date-picker
                                v-model="item.birthday"
                                placeholder="出生日期"
                                style="width: 135px"
                                @change="birthdayChange(index)"
                                value-format="yyyy-MM-dd"
                              >
                              </el-date-picker>
                            </el-form-item>
                            <div
                              style="text-decoration: underline; color: #4f4f4f"
                            >
                              {{
                                item.passType == "adult"
                                  ? "成人"
                                  : item.passType == "children"
                                  ? "儿童"
                                  : item.passType == "baby"
                                  ? "婴儿"
                                  : ""
                              }}
                              <!-- 成人 -->
                            </div>
                          </div>
                          <div class="ch_top" v-if="chooseDownStatus[index]">
                             <el-form-item label="英文姓" label-width="80px">
                              <el-input
                                v-model="item.englishSurname"
                              >
                              </el-input>
                            </el-form-item>
                            <el-form-item label="英文名" label-width="80px"> 
                              <el-input
                                v-model="item.englishName"
                              >
                              </el-input>
                            </el-form-item>
                          </div>
                          <div class="ch_top" v-if="chooseDownStatus[index]">
                            <el-form-item label="持有人国籍" label-width="120px">
                              <foreign-area :popularCity=" { value:'CN',label:'中国'}"   @selectcountry="selectFnCountry($event,index,'nationality')"></foreign-area>
                            </el-form-item>
                            <el-form-item label="发证国家" label-width="120px">
                              <foreign-area :popularCity=" { value:'CN',label:'中国'}"  @selectcountry="selectFnCountry($event,index,'docIssueCountry')"></foreign-area>
                            </el-form-item>
                            <el-form-item label="证件有效日期" label-width="120px">
                             <el-date-picker
                                style="width: 140px"
                                v-model="item.IDValidDate"
                                type="date"
                                placeholder="选择日期"
                                value-format="yyyy-MM-dd"
                              >
                              </el-date-picker>
                            </el-form-item>
                          </div>
                        </div>
                      </el-form>
                      <el-table
                        :ref="'productItemTable'+index"
                        :data="item.product"
                        :show-header = "false"
                        tooltip-effect="dark"
                        style="width: 100%"
                        @select="(selection, row)=> productcurrent(selection,row,index,item.product)">
                        <el-table-column
                          type="selection"
                          width="55">
                        </el-table-column>
                        <el-table-column
                          width="120">
                          <template slot-scope="scope">
                            <el-tooltip
                              placement="bottom"
                              effect="light"
                            >
                              <div slot="content">
                                <div>简介：{{ scope.row.productBrief }}</div>
                                <div>详细说明：{{ scope.row.productIntroduce }}</div>
                                  <!-- <div>强制提醒：{{ items.remaid }}</div> -->
                                </div>
                              <div>{{ scope.row.productName }}</div>
                              </el-tooltip>
                          </template>
                        </el-table-column>
                        <el-table-column
                          width="120">
                        <template>
                          全程
                        </template>
                        </el-table-column>
                        <el-table-column
                          prop="salesMoney"
                          show-overflow-tooltip>
                        </el-table-column>
                      </el-table>
                    </div>
                  </div>
                  <div class="three-3-1">
                    <el-button
                      @click.stop="showBoxBtn"
                      size="mini"
                      type="success"
                      >添加乘客
                    </el-button>
                    <el-button @click="passengersBtn" size="mini" type="success"
                      >选择常旅客
                    </el-button>
                    <el-button @click="confirmed" size="mini" type="success"
                      >生成预定命令</el-button
                    >
                    <div class="three-4" v-if="false" style="margin-left: 10px">
                      <el-checkbox v-model="checked" style="display: flex">
                        <span style="font-size: 12px">儿童订成人特价 </span>
                      </el-checkbox>
                      <span
                        style="
                          font-size: 11px;
                          margin-left: 5px;
                          color: #abb9c2;
                          text-decoration: underline;
                        "
                        >说明
                      </span>
                    </div>
                  </div>
                  <!-- <div class="three-3-2">
                    <div>
                      注：同时存在儿童和成人时，用“成人PNR|儿童PNR”，“成人行动代码|儿童行动代码”隔开(<span
                        style="color: #ff0000"
                        >切记顺序不能错和混填</span
                      >)
                    </div>
                  </div> -->

                  <div class="three-3-3">
                    <div class="tww">
                      <div class="two-1">
                        <el-form-item label="记录编：">
                          <el-input
                            :disabled="true"
                            size="mini"
                            v-model="objPnr.pnr"
                            placeholder=""
                          >
                          </el-input>
                        </el-form-item>
                      </div>
                      <div class="two-1">
                        <el-form-item label="执行代码：">
                          <el-input
                            :disabled="true"
                            style="width: 120px"
                            size="mini"
                            v-model="objPnr.actionCode"
                          >
                          </el-input>
                        </el-form-item>
                      </div>
                      <div
                        style="
                          color: #abb9c2;
                          font-size: 12px;
                          margin-top: 5px;
                          text-decoration: underline;
                        "
                      >
                        <el-button size="mini" type="primary" @click="cancelpnr"
                          >取消pnr</el-button
                        >
                      </div>
                    </div>
                  </div>
                  <div class="three-3-2" v-show="pncList.length != 0">
                    <div>
                      注：PNR已生成，请勿更改乘客信息，如需变更请-<span
                        style="color: red; text-decoration: underline"
                        @click="cancelOrder"
                        >取消订座</span
                      >
                    </div>
                  </div>
                </div>
              </el-form>
            </div>
          </div>
          <div
            class="fli_box1"
            id="Ticketdetails1"
            v-loading="loading"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.5)"
            :data="objPnr"
            style="width: 100%"
          ></div>
          <!-- 取消pnr -->
          <el-dialog
            title="取消pnr"
            :visible.sync="cancelwindow"
            :close-on-click-modal="false"
            width="20%"
          >
            <div style="display: flex">
              <el-button type="primary" @click="cancelwindow = false"
                >取消</el-button
              >
              <el-button type="primary" @click="determinecancelpnrpnr"
                >确定</el-button
              >
            </div>
          </el-dialog>
          <!-- 新增常旅客 -->
          <el-dialog
            title="选择常旅客"
            :close-on-click-modal="false"
            :visible.sync="passengers"
            :before-close="asdfasdfsdfsf"
            width="80%"
          >
            <el-table
              border
              :data="Frequenflyer"
              @selection-change="handleSelectionChange"
              size="mini"
              :header-cell-style="{
                color: '#fff',
                background: '#6090EC',
                fontSize: '11px',
                fontWeight: 'normal',
              }"
              style="width: 100%"
            >
              <el-table-column type="selection" width="36"> </el-table-column>
              <el-table-column prop="passName" label="中文姓名" width="120">
                <template slot-scope="scope">
                  <span>{{scope.row.passName || scope.row.englishName}}</span>
                </template>
              </el-table-column>
              <el-table-column prop="passSex" label="性别" width="50">
                <template slot-scope="scope">
                  <template v-if="scope.row.passSex == 'male'">男</template>
                  <template v-if="scope.row.passSex == 'female'">女</template>
                </template>
              </el-table-column>
              <el-table-column prop="passType" label="类型" width="50">
                <template slot-scope="scope">
                  <template v-if="scope.row.passType == 'children'">儿童
                  </template>
                  <template v-else-if="scope.row.passType == 'baby'">婴儿
                  </template>
                  <template v-else>成人</template>
                </template>
              </el-table-column>
              <el-table-column
                prop="certificateType"
                label="证件类型"
              >
                <template slot-scope="scope">
                  {{scope.row.certificateType | certificateValue}}
                </template>
              </el-table-column>
              <el-table-column
                prop="certificateNumber"
                label="证件号码"
              >
              </el-table-column>
              <el-table-column prop="birthday" label="出生日期" width="90">
              </el-table-column>
              <el-table-column prop="nationalityName" label="国籍" width="90">
              </el-table-column>
              <el-table-column
                prop="certificateDate"
                label="证件过期时间"
                width="110"
              >
              </el-table-column>
              <el-table-column
                prop="passPhone"
                label="手机号码"
                width="130"
              >
              </el-table-column>
            </el-table>
            <div class="clk_1">
              <el-button class="clk" @click="Addpassengers">确定</el-button>
            </div>
          </el-dialog>
          <!-- 联系信息 -->
          <div class="seven">
            <div class="tuo">
              <div class="tuo-2"></div>
              <span>联系信息</span>
            </div>
            <el-form
              size="mini"
              :inline="true"
              :model="relation"
              ref="relation"
              :rules="relationrules"
              class="othersed"
            >
              <el-form-item label="姓名" prop="ReactName" label-width="60px">
                <el-input
                  size="mini"
                  v-model="relation.ReactName"
                  :rules="relationrules"
                  ref="ruleForm"
                >
                </el-input>
              </el-form-item>
              <el-form-item label="手机号" prop="phoneNum" label-width="70px">
                <el-input size="mini" v-model="relation.phoneNum"></el-input>
              </el-form-item>
            </el-form>
          </div>
          <!-- 配送信息 -->
          <div class="seven">
            <div class="tuo">
              <div class="tuo-2"></div>
              <span>配送信息</span>
            </div>
            <el-form
              size="mini"
              :inline="true"
              :data="way"
              class="others"
              :rules="wayRules"
            >
              <!-- 2 -->
              <!-- <div class="six-2">办事处详情</div> -->
              <el-form-item label="配送方式" label-width="80px">
                <el-select
                  v-model="shipvalue"
                  size="mini"
                  placeholder="请选择"
                  clearable
                >
                  <el-option
                    v-for="item in shipList"
                    :key="item.value + Math.random()"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <div class="expressBox" v-show="showExpress">
                <!-- <div style="color: red">行程（哈尔滨-黑河）提供纸质行程单</div> -->
                <div class="express-1"></div>
                <!-- <el-form-item label="填写发票备注" label-width="100px">
                  <el-input
                    type="textarea"
                    style="width: 300px"
                    placeholder="请输入发票备注"
                    v-model="way.invoice"
                  >
                  </el-input>
                </el-form-item> -->
                <div
                  class="express-1"
                  style="margin-top: 5px; margin-bottom: 5px"
                >
                  <el-button type="text" @click="openAddemailDialogVisible">新增邮寄地址</el-button>
                  <el-form ref="form" :model="deliverAssign" size="mini">
                    <el-form-item label="已有邮寄地址">
                      <el-select v-model="selectAddressVal"
                        style="width: 400px"
                        @change="changeAddressVal"
                        placeholder="邮寄地址" clearable>
                        <el-option v-for="item in mailingddressList" :key="item.id" :label="item.detailedAddress"
                          :value="item.detailedAddress">
                        </el-option>
                      </el-select>
                    </el-form-item>
                    <el-form-item label="邮寄地址">
                      <el-input
                        v-model="deliverAssign.contactAddress"
                        style="width: 400px"
                      ></el-input>
                    </el-form-item>
                    <div style="display: flex">
                      <el-form-item label="邮政编码">
                        <el-input v-model="deliverAssign.contactPostcode"></el-input>
                      </el-form-item>
                      <el-form-item label="收件人">
                        <el-input v-model="deliverAssign.contactName"></el-input>
                      </el-form-item>
                    </div>
                    <el-form-item label="收件人手机">
                      <el-input v-model="deliverAssign.contactPhone"></el-input>
                    </el-form-item>
                    <!-- <el-form-item label="收件人邮箱">
                      <el-input v-model="deliverAssign.contactEmail"></el-input>
                    </el-form-item> -->
                  </el-form>
                </div>
              </div>
              <!-- <div>开票总金额：0元</div> -->
              <!-- 新增邮寄地址 -->
              <el-dialog
                title="新增邮寄地址"
                :visible.sync="addemailDialogVisible"
                width="30%"
                center
              >
                <el-form
                  size="mini"
                  :inline="true"
                  :data="addemallway"
                  :model="addemallway"
                  class="pop"
                  :rules="addemailrules"
                >
                  <el-form-item label="收货人" prop="consignee" label-width="100px">
                    <el-input
                      size="mini"
                      v-model="addemallway.consignee"
                    ></el-input>
                  </el-form-item>
                  <el-form-item
                    label="手机号码"
                    prop="addphone"
                    label-width="100px"
                  >
                    <el-input
                      v-model="addemallway.addphone"
                      size="mini"
                    ></el-input>
                  </el-form-item>
                  <el-form-item
                    label="标签"
                    prop="label"
                    label-width="100px"
                  >
                    <el-input
                      size="mini"
                      v-model="addemallway.label"
                    ></el-input>
                  </el-form-item>
                  <el-form-item
                    label="所在地区"
                    prop="region"
                    label-width="100px"
                  >
                    <el-input v-model="addemallway.region"></el-input>
                  </el-form-item>
                  <el-form-item
                    label="详细地址"
                    prop="detailedAddress"
                    label-width="100px"
                  >
                    <el-input
                      :autosize="{ minRows: 12, maxRows: 12 }"
                      v-model="addemallway.detailedAddress"
                    ></el-input>
                  </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                  <el-button @click="addemailDialogVisible = false"
                    >取 消</el-button
                  >
                  <el-button type="primary" @click="getbackInsertAddresses()"
                    >确 定</el-button
                  >
                </span>
              </el-dialog>
              <div class="six-1" v-show="showAirport">
                <!-- <p>取票地点</p> -->
                <div class="five-2">
                  <div
                    style="font-size: 12px; margin-top: 5px; margin-right: 5px"
                  ></div>
                  <el-form-item label="取票地点" label-width="80px">
                    <!-- prop="Airvalue" -->
                    <el-select
                      v-model="Airvalue"
                      size="mini"
                      style="width: 500px; margin-right: 10px"
                      placeholder="请选择"
                      clearable
                    >
                      <el-option
                        v-for="item in AirList"
                        :key="item.airportId +  Math.random()"
                        :label="item.address"
                        :value="item.address"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </div>
              </div>
              <div class="six-1" style="margin-left: 20px" v-show="showRetain">
                <p style="color: red">
                  您好，机票行程最多保留30天，您确认好了及时通知我们邮寄以免超期无法打印！
                </p>
              </div>
              <div
                class="six-1"
                style="margin-left: 20px"
                v-if="fapiao == true"
              >
                <el-input
                  v-model="invoiceaa.invoiceName"
                  placeholder="请输入抬头"
                  size="mini"
                ></el-input>
                <el-input
                  v-model="invoiceaa.taxId"
                  placeholder="请输入税号"
                  size="mini"
                ></el-input>
                <el-input
                  v-model="invoiceaa.invoiceCash"
                  style="width: 300px"
                  placeholder="请输入金额"
                  size="mini"
                >
                </el-input>
              </div>
            </el-form>
          </div>
          <!-- 其他选项 -->
          <div class="seven">
            <div class="tuo">
              <div class="tuo-2"></div>
              <span>其他选项</span>
            </div>
            <div class="seven-1">
              <el-form
                size="mini"
                :inline="true"
                :data="otheroptions"
                class="others"
              >
                <el-form-item label="合作商备注" label-width="110px">
                  <el-select v-model="otheroptions.remark" clearable>
                    <el-option
                      v-for="item in otherValue"
                      :key="item.value + Math.random()"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="内部注意事项" label-width="110px">
                  <el-input
                    type="textarea"
                    size="medium"
                    v-model="otheroptions.attention"
                    placeholder=""
                    style="width: 300px"
                  >
                  </el-input>
                </el-form-item>
                <el-form-item label="可勾选项" label-width="110px">
                  <el-radio-group v-model="otheroptions.checkValue">
                    <el-radio label="直接验价"></el-radio>
                    <el-radio label="官网产品"></el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </div>
          </div>
          <!-- 立即处理按钮 -->
          <div class="ten">
            <el-button
              size="medium"
              style="height: 40px; color: #fff; background-color: #f6b23e"
              @click="getcRMnUM"
            >
              立即处理
            </el-button>
          </div>
        </div>
        <!-- 右 -->
        <div class="one-2">
          <div>
            <div class="one-3">
              <span> 去 {{ getseyears(flight.depDate) }} </span>
              <span> {{ stateTime }} </span>
              <div>
                <span>
                  {{flight.orgCityName}}{{flight.orgAirportName}}{{flight.depTerm }}
                </span>--
                <span>
                  {{flight.dstCityName}}{{flight.dstAirportName}}{{flight.arrTerm }}
                </span>
              </div>
            </div>
            <div class="one-4" v-if="type == 'return'">
              <div><img :src="flight.airlineGif" class="image" alt="" /></div>
              <div style="width:64%">{{ flight.airline }} {{ flight.flightNo }} {{ GoSearchWhere.cabin
              }}{{ GoSearchWhere.baseCabinName }}{{ cabin }} {{flight.planeStyle}}
              {{flight.meal}}</div>
               <el-tooltip effect="light" placement="top" style="margin-left:12px,display:inline-block">
                <div class="f_box_t">退改签</div>
                 <div slot="content" v-if="flightMes">
                  <div>
                    <span>行李额：</span>
                      <div>
                        <div style="display: flex; justify-content: space-between">
                          <div>{{flightMes.baggage}}
                          </div>
                          <!-- <div>{{ item1.changeRules }}</div> -->
                        </div>
                      </div>
                  </div>
                  <div>
                    <span>改签规则：</span>
                    <div
                        v-for="(item1, index) in flightMes.changeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                          v-if="flightMes.changeRules.length != 0"
                        >
                          <div>{{ item1.time }}</div>
                          <div>{{ item1.changeRules }}</div>
                        </div>
                    </div>
                    <div v-if="flightMes.changeRules.length == 0">
                        <div>暂无改签规则</div>
                    </div>
                  </div>
                  <div style="margin: 20px 0 0 0">退票规则：</div>
                      <div
                        v-for="(item1, index) in flightMes.refundChangeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                        >
                          <div style="margin: 0 20px 0 0">{{ item1.time }}</div>
                          <div>{{ item1.refundRules }}</div>
                        </div>
                      </div>
                 </div>
               </el-tooltip>
            </div>
            <!-- 退改签规则 -->
            <div class="one-4" v-if="this.type != 'return'">
              <div><img :src="flight.airlineGif" class="image" alt="" /></div>
              <div style="width:64%"> {{ flight.airline }} {{ flight.flightNo }} {{ GoSearchWhere.cabin
                }}{{ GoSearchWhere.baseCabinName }}{{ cabin }}  {{flight.planeStyle}}
               {{flight.meal}}
              </div>
              <el-tooltip effect="light" placement="top" style="margin-left:12px,display:inline-block">
                <div class="f_box_t">退改签</div>
                <div slot="content" v-if="flightMes">
                  <div slot="content">
                    <div>
                      <span>行李额：</span>
                      <div>
                        <div style="display: flex; justify-content: space-between">
                          <div>{{flightMes.listCabinInfo[flightMesindex].baggage}}
                          </div>
                          <!-- <div>{{ item1.changeRules }}</div> -->
                        </div>
                      </div>
                      <div
                        v-if="
                          flightMes.listCabinInfo[flightMesindex].baggage ==
                          null
                        "
                      >
                        <div>暂无行李额</div>
                      </div>
                      <span>改签规则：</span>
                      <div
                        v-for="(item1, index) in flightMes.listCabinInfo[
                          flightMesindex
                        ].changeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                          v-if="
                            flightMes.listCabinInfo[flightMesindex].changeRules
                              .length != 0
                          "
                        >
                          <div>{{ item1.time }}</div>
                          <div>{{ item1.changeRules }}</div>
                        </div>
                      </div>
                      <div
                        v-if="
                          flightMes.listCabinInfo[flightMesindex].changeRules
                            .length == 0
                        "
                      >
                        <div>暂无改签规则</div>
                      </div>
                      <div style="margin: 20px 0 0 0">退票规则：</div>
                      <div
                        v-for="(item1, index) in flightMes.listCabinInfo[
                          flightMesindex
                        ].refundChangeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                        >
                          <div style="margin: 0 20px 0 0">{{ item1.time }}</div>
                          <div>{{ item1.refundRules }}</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </el-tooltip>
            </div>
            <div class="one-5">
              <div class="one-5-1">
                <div>{{ getset2(flight.depDate) }}</div>
                <div class="one-5-1-1">{{ flight.flightTimes }}</div>
                <div>
                  {{ getset2(flight.arrDate) }}
                  <span
                    style="margin: 0 0 0 10px; color: red"
                    v-if="flight.arrad == 1"
                    >+1天</span
                  >
                  <span
                    style="margin: 0 0 0 10px; color: red"
                    v-if="flight.arrad == 2"
                    >+2天</span
                  >
                </div>
              </div>
            </div>
            <div class="one-6">
              <div class="one-6-1">
                <div>{{ flight.orgAirportName }}{{ flight.depTerm }}</div>
                <div class="one-5-1-1" v-if="flight.stopCount != 1">
                  ------------------
                </div>
                <div v-if="flight.stopCount == 1">
                  <span style="color: #b0bdc6"
                    >{{ flight.stopPlace }}(经停){{ flight.stopTime }}</span
                  >
                  <!-- <el-tooltip content="Bottom center" placement="bottom" effect="light">
                    <div slot="content">经停时长{{ flight.stopTime }}</div>
                    <div slot="content">开始时间{{ flight.stopDate==null ?'暂无开始时间':item.stopDate }}</div>
                    <div slot="content">结束时间{{ flight.stopEndDate==null ?'暂无结束时间' :item.stopEndDate }}</div>
                    <span style="color: #0033ff">{{ flight.stopPlace }}</span>
                  </el-tooltip> -->
                </div>
                <div>{{ flight.dstAirportName }}{{ flight.arrTerm }}</div>
              </div>
            </div>
          </div>
          <div v-if="BackSearchWhere.OrgAirport">
            <div class="one-3">
              <span> 返 {{ getseyears(flights.depDate) }} </span>
              <span> {{ endtime }} </span>
              <div>
                <span>
                  {{flights.orgCityName}}{{flights.orgAirportName }}{{flights.depTerm }}
                </span>--
                <span>
                  {{flights.dstCityName}}{{flights.dstAirportName }}{{flights.arrTerm }}
                </span>
              </div>
            </div>
            <div class="one-4">
              <div><img :src="flights.airlineGif" class="image" alt="" /></div>
              <div style="width:64%"> {{ flights.airline }} {{ flights.flightNo }}
              {{ BackSearchWhere.cabin }} {{ BackSearchWhere.baseCabinName
              }} {{ cabin }} {{flight.planeStyle}} {{flight.meal}}</div>
               <el-tooltip effect="light" placement="top" style="margin-left:12px,display:inline-block">
                <div class="f_box_t">退改签</div>
                 <div slot="content" v-if="flightReTurnMes">
                  <div>
                    <span>行李额：</span>
                      <div>
                        <div style="display: flex; justify-content: space-between">
                          <div>{{flightReTurnMes.baggage}}
                          </div>
                          <!-- <div>{{ item1.changeRules }}</div> -->
                        </div>
                      </div>
                  </div>
                  <div>
                    <span>改签规则：</span>
                    <div
                        v-for="(item1, index) in flightReTurnMes.changeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                          v-if="flightReTurnMes.changeRules.length != 0"
                        >
                          <div>{{ item1.time }}</div>
                          <div>{{ item1.changeRules }}</div>
                        </div>
                    </div>
                    <div v-if="flightReTurnMes.changeRules.length == 0">
                        <div>暂无改签规则</div>
                    </div>
                  </div>
                  <div style="margin: 20px 0 0 0">退票规则：</div>
                      <div
                        v-for="(item1, index) in flightReTurnMes.refundChangeRules"
                        :key="index + Math.random()"
                      >
                        <div
                          style="display: flex; justify-content: space-between"
                        >
                          <div style="margin: 0 20px 0 0">{{ item1.time }}</div>
                          <div>{{ item1.refundRules }}</div>
                        </div>
                      </div>
                 </div>
               </el-tooltip>
            </div>
            <div class="one-5">
              <div class="one-5-1">
                <div>{{ getset2(flights.depDate) }}</div>
                <div class="one-5-1-1">{{ flights.flightTimes }}</div>
                <div>{{ getset2(flights.arrDate) }}
                  <span
                    style="margin: 0 0 0 10px; color: red"
                    v-if="flights.arrad == 1"
                    >+1天</span
                  >
                  <span
                    style="margin: 0 0 0 10px; color: red"
                    v-if="flights.arrad == 2"
                    >+2天</span
                  >
                </div>
              </div>
            </div>
            <div class="one-6">
              <div class="one-6-1">
                <div>{{ flights.orgAirportName }}{{ flights.depTerm }}</div>
                <div class="one-5-1-1">------------------</div>
                <div>{{ flights.dstAirportName }}{{ flights.arrTerm }}</div>
              </div>
            </div>
          </div>
          <div class="one-7"></div>
          <div class="one-8">
            <div class="one-8-1">
              <div v-if="type == 'where' || type == 'return' " style="margin: 3px">
                <span>票价明细：</span>
                <div class="one-8-1" v-if="productcurrentprice.length" style="margin-top:6px">
                  <div>辅营产品</div>
                  <div>
                  ￥{{ productcurrentprice.reduce((a,b)=>a+b) }}<span style="color: #abb9c2"></span>
                  </div>
                </div>
                <div class="one-8-1" v-if="shipvalueprivk == 10">
                  <div>邮寄客票</div>
                  <div>
                    ￥{{ shipvalueprivk }}<span style="color: #abb9c2"></span>
                  </div>
                </div>
                <div class="priceInfo">
                  <div>
                    <span>成人<span v-if="type == 'return'">(去)</span> ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.wherePrice.titckPrice }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{ priceObj.wherePrice.airportTax }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{ priceObj.wherePrice.fuelTax }}</span>
                    </div>
                  </div>
                  <div v-if="GoSearchWhere.hasChildren">
                    <span>儿童<span v-if="type == 'return'">(去)</span> ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.wherePrice.childPrice*1 }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{ priceObj.wherePrice.childAirportTax }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{priceObj.wherePrice.childFuelTax}}</span>
                    </div>
                  </div>
                  <div v-if="GoSearchWhere.hasBaby">
                    <span>婴儿<span v-if="type == 'return'">(去)</span> ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.wherePrice.bodyPrice }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{ priceObj.wherePrice.bodyAirportTax }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{ priceObj.wherePrice.bodyFuelTax }}</span>
                    </div>
                  </div>
                </div>
                <div class="priceInfo" v-if="type == 'return'">
                  <div>
                    <span>成人<span>(返)</span> ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.returnPrice.backPrice}}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{ priceObj.returnPrice.airportTax }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{ priceObj.returnPrice.fuelTax }}</span>
                    </div>
                  </div>
                  <div v-if="GoSearchWhere.hasChildren">
                    <span>儿童<span>(返)</span>  ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.returnPrice.childBackprice*1 }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{priceObj.returnPrice.childAirportTax}}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{priceObj.returnPrice.childFuelTax}}</span>
                    </div>
                  </div>
                  <div v-if="GoSearchWhere.hasBaby">
                    <span>婴儿<span>(返)</span>  ：</span>
                    <div class="one-8-8">
                      <span>票价：</span>
                      <span>￥{{ priceObj.returnPrice.bodybackprice*1 }}</span>
                    </div>
                    <div class="one-8-8">
                      <span>机建费：</span>
                      <span>￥{{priceObj.returnPrice.bodyAirportTax}}</span>
                    </div>
                    <div class="one-8-8">
                      <span>燃油费：</span>
                      <span>￥{{priceObj.returnPrice.bodyFuelTax}}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 
						<div class="one-8-1">
							<div>成人套餐</div>
							<div>￥448<span style="color: #abb9c2">×2</span></div>
						</div>
						<div class="one-8-1">
							<div>成人套餐</div>
							<div>￥448<span style="color: #abb9c2">×2</span></div>
						</div>
						<div class="one-8-2"></div> -->
            <div v-if="checkList">
              <div
                class="one-8-1"
                v-for="(item, index) in checkList"
                :key="index + Math.random()"
              >
                <div>{{ item.name }}</div>
                <!--  价格之前是  underlinePrice 不对 比实际价格多一元  现在换成salesMoney -->
                <div>
                  <span style="color: #abb9c2">￥{{ item.salesMoney }}</span>
                </div>
              </div>
            </div>
            <div class="one-7"></div>
            <div class="one-8-3">
              <div class="one-8-4" @click="editTicketPriceMethod()">
                修改票价
              </div>
              <div class="one-8-5">
                ￥{{
                  sumprice + this.shipvalueprivk
                }}
                <!-- +ListGoSegment[0].Tax+
                ListGoSegment[0].OilFee -->
              </div>
            </div>
            <div class="one-7"></div>
            <div class="five_t">
              <div>客人预定但不确定机出票:</div>
              <div>
                机票需要帮您咱订，折扣和机位都是以您通知出票时为准，请您尽快来通知我们出票，以免订座取消。
              </div>
              <div class="one-9-1">客人出票:</div>
              <div>具体折扣和机位以您支付成功出票后为准</div>
            </div>
            <div class="one10">
              <router-link
                target="_blank"
                :to="{ path: '/flight/reserve', params: { id: '8' } }"
                >＋新建窗口下单-修改航班
              </router-link>
            </div>
          </div>
        </div>
      </div>
      <div v-else>
        <div class="tuo">
          <div class="tuo-2"></div>
          <span>航班信息</span>
        </div>
        <el-table
          :data="orders[0].orderDetaileArr"
          border
          style="width: calc(100% - 60px) ;margin-left:30px">
          <el-table-column
            label="起飞"
            width="80">
            <template slot-scope="scope">
              {{ scope.row.orgAirportName || scope.row.departureAirportName}}
            </template>
          </el-table-column>
          <el-table-column
            label="到达"
            width="80">
             <template slot-scope="scope">
             {{ scope.row.dstAirportName || scope.row.arriveAirportName}}
            </template>
          </el-table-column>
          <el-table-column
            label="票价"
            width="80">
             <template slot-scope="scope">
             {{ scope.row.ticketAmount || scope.row.listCabinInfo[0].ticketPrice}}
            </template>
          </el-table-column>
          <el-table-column
            label="基建"
            width="80">
             <template slot-scope="scope">
             {{ scope.row.airportAmount || scope.row.airportTax}}
            </template>
          </el-table-column>
          <el-table-column
            label="燃油"
            width="80">
             <template slot-scope="scope">
             {{ scope.row.fuelAmount || scope.row.fuelTax}}
            </template>
          </el-table-column>
          <el-table-column
            label="起飞时间">
             <template slot-scope="scope">
              {{ scope.row.depDate || scope.row.departureTime}}
            </template>
          </el-table-column>
        </el-table>
        <div class="tuo">
          <div class="tuo-2"></div>
          <span>用户信息</span>
        </div>
        <el-table
          :data="orders"
          border
          style="width: calc(100% - 60px) ;margin-left:30px">
          <el-table-column
            label="姓名"
            prop="passengerName"
            width="80">
          </el-table-column>
          <el-table-column
            label="类型"
            prop="passengerType"
            width="80">
            <template slot-scope="scope">
             {{scope.row.passengerType === "adult"?"成人":scope.row.passengerType === "children"?"儿童":"婴儿"}}
            </template>
          </el-table-column>
          <el-table-column
            label="舱位"
            width="80"
          >
             <template>
             {{GoSearchWhere.cabin}}
            </template>
          </el-table-column>
          <el-table-column
            label="航班号"
            width="80"
          >
             <template>
             {{GoSearchWhere.newFlightNo}}
            </template>
          </el-table-column>
          <el-table-column
            label="机型"
            width="80"
          >
             <template>
             {{GoSearchWhere.planeStyle}}
            </template>
          </el-table-column>
          <el-table-column
            prop="passengerPhone"
            label="手机号"
          >
          </el-table-column>
          <el-table-column
            label="身份证号"
            prop="idNumber"
          >
          </el-table-column>
        </el-table>
        <div class="tuo">
          <div class="tuo-2"></div>
          <span>价格信息</span>
        </div>
        <el-form :inline="true" @submit.native.prevent style="margin-left:30px">
          <el-form-item label="改签差价">
            <el-input v-model="changePrice" disabled></el-input>
          </el-form-item>
          <el-form-item label="改签服务费">
            <el-input v-model="serviceAmount"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="getCRM" >确认并创建订单</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <!-- 注册弹窗 -->
    <el-dialog
      title="注册会员"
      :visible.sync="registerdialogVisible"
      width="90%"
    >
      <el-form
        :model="ruleForm"
        :rules="registerrules"
        size="mini"
        ref="ruleForm"
        class="demo-ruleForm"
        label-width="110px"
      >
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item
            label="姓名"
            prop="userName"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-input
              style="width: 120px"
              v-model="ruleForm.userName"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="生日"
            prop="birthday"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-date-picker
              size="mini"
              style="width: 120px"
              v-model="ruleForm.birthday"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item
            label="证件号"
            prop="certificateNumber"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-input
              style="width: 220px"
              v-model="ruleForm.certificateNumber"
            ></el-input>
          </el-form-item>
        </div>
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item
            label="手机号"
            prop="phoneOne"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-input
              style="width: 120px"
              v-model="ruleForm.phoneOne"
            ></el-input>
          </el-form-item>
          <el-form-item
            label="证件类型"
            prop="certificateType"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-select
              style="width: 120px"
              v-model="ruleForm.certificateType"
              placeholder="请选择"
              clearable
            >
              <el-option
                v-for="item in certificate"
                :key="item.value + Math.random()"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            label="证件有效期"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-date-picker
              size="mini"
              style="width: 120px"
              v-model="ruleForm.certificateDate"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </el-form-item>
        </div>
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item label="微信" style="display: flex; margin: 0 15px 0 0">
            <el-input v-model="ruleForm.userWechat"></el-input>
          </el-form-item>
          <el-form-item
            label="性别"
            prop="userSex"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-select
              style="width: 120px"
              v-model="ruleForm.userSex"
              placeholder="请选择性别"
              clearable
            >
              <el-option label="男" value="male"></el-option>
              <el-option label="女" value="female"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="邮箱">
            <el-input v-model="ruleForm.userEmail"></el-input>
          </el-form-item>
        </div>
        
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item
            label="常住地"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-input  style="width: 500px" v-model="ruleForm.residence"></el-input>
          </el-form-item>
        </div>
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item
            label="联系要求"
            style="display: flex; margin: 0 15px 0 0"
          >
            <el-select
              v-model="ruleForm.requirement"
              style="width: 500px"
              placeholder="请选择活动区域"
              clearable
            >
              <el-option label="无" value=""></el-option>
              <el-option
                label="不允许联系"
                value="不允许联系"
              ></el-option>
              <el-option label="可以联系" value="可以联系"></el-option>
              <el-option
                label="不要频繁联系"
                value="不要频繁联系"
              ></el-option>
            </el-select>
          </el-form-item>
        </div>
        <div style="display: flex; margin: 0 0 15px 0">
          <el-form-item label="备注" style="display: flex; margin: 0 15px 0 0">
            <el-input
              type="textarea"
              :rows="2"
              style="width: 500px"
              v-model="ruleForm.remark"
            ></el-input>
          </el-form-item>
        </div>
        <div style="margin: 30px 0 0 45%">
          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')">
            立即创建</el-button>
            <el-button @click="registerdialogVisible = false">取消</el-button>
          </el-form-item>
        </div>
      </el-form>
    </el-dialog>
    <!-- 修改票价弹窗 -->
    <el-dialog
      title="修改票价"
      :visible.sync="editTicketPriceDiloag"
      width="30%"
    >
      <el-form
        :model="editTicketPrice"
        :rules="editTicketPricerules"
        size="mini"
        ref="editTicketPrice"
        class="demo-ruleForm"
        label-width="90px"
      >
        <el-form-item label="票面价" prop="TicketPrice" label-width="100px">
          <el-input
            size="mini"
            style="width: 250px"
            v-model="editTicketPrice.TicketPrice"
          ></el-input>
        </el-form-item>
        <el-form-item label="基建费" prop="jijianPrice" label-width="100px">
          <el-input
            size="mini"
            style="width: 250px"
            v-model="editTicketPrice.jijianPrice"
          ></el-input>
        </el-form-item>
        <el-form-item label="燃油费" prop="ranyouPrice" label-width="100px">
          <el-input
            size="mini"
            style="width: 250px"
            v-model="editTicketPrice.ranyouPrice"
          ></el-input>
        </el-form-item>
      </el-form>
      <div>
        <div style="color: red">注：所有乘客类型必须一致</div>
      </div>
      <div style="display: flex; justify-content: center">
        <el-button type="primary" @click="editTicketPriceDiloag = false"
          >确定</el-button
        >
        <el-button @click="editTicketPriceDiloag = false">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import crumbs from "../../components/Crumbs.vue";
import foreignArea from "@/components/sw-area/foreignArea.vue"
import Pinyin from "js-pinyin";
export default {
  name: "Ticketdetails",
  components: {
    crumbs,
    foreignArea
    // Loading,
  },
  data() {
    return {
      // 修改票价弹窗
      editTicketPriceDiloag: false,
      textArr:[],
      changePrice:0,
      serviceAmount:0,
      // 修改票价表单数据
      editTicketPrice: {
        TicketPrice: "",
        jijianPrice: "",
        ranyouPrice: "",
      },
      // 表单验证规则
      editTicketPricerules: {
        TicketPrice: [
          {
            required: true,
            message: "请输入票面价",
            trigger: "blur",
          },
        ],
        jijianPrice: [
          {
            required: true,
            message: "请输入基建费",
            trigger: "blur",
          },
        ],
        ranyouPrice: [
          {
            required: true,
            message: "请输入燃油费",
            trigger: "blur",
          },
        ],
      },
      cabinLeftDesc: "", //座位数
      invoiceaa: {
        invoiceName: "",
        invoiceCash: null,
        taxId: "",
      },
      deliverAssign: {
        ticketAddress: "",
        postWay: null,
      },
      deliverAssign:{
        deliverType:null,  //配送类型 机场取票 airportTicket 邮寄客票 postTicket 保留行程单 reservedItinerary 无需行程单 notItinerary 发票 invoice
        contactName:null,  //收货人姓名
        contactPhone:null,  //收货人手机
        contactEmail:null,  //收货人邮箱
        contactAddress:null,  //收货人地址
        contactPostCode:null, //收货人邮编
        ticketAddress: null // 取票地址
      },
      fapiao: false,
      // 注册表单
      ruleForm: {
        userSex: "",
        userName: "",
        certificateNumber: "",
        birthday: "",
        phoneOne: "",
        certificateDate: "",
        profession: "",
        characterTraits: "",
        jobTitle: "",
        customerPreferences: "",
        nationality: "",
        maritalStatus: "",
        chineseZodiac: "",
        constellation: "",
        requirement: "",
        mailingAddress: "",
        userWechat: "",
        userEmail:"",
        residence:"",
        language: "",
        countryCitizenship: "",
        hometown: "",
        currentCity: "",
        membershipLevel: "",
        bloodType: "",
        remark: "",
      },
      // 表单验证规则
      registerrules: {
        userName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "blur",
          },
        ],
        birthday: [
          {
            required: true,
            message: "选择生日",
            trigger: "change",
          },
        ],
        certificateNumber: [
          {
            required: true,
            message: "请输入证件号",
            trigger: "blur",
          },
        ],
        phoneOne: [
          {
            required: true,
            message: "请输入手机号",
            trigger: "blur",
          },
        ],
        // certificateDate: [{
        //   required: true,
        //   message: "请选择证件有效期",
        //   trigger: "change"
        // }, ],
        certificateType: [
          {
            required: true,
            message: "请选择证件类型",
            trigger: "change",
          },
        ],
        userSex: [
          {
            required: true,
            message: "请选择性别",
            trigger: "change",
          },
        ],
      },
      // 注册弹窗
      registerdialogVisible: false,
      BackSearchWhere: {},
      cancelwindow: false,
      sumprice: 0,
      // 通用产品
      selectReturnData: [],
      // 通用产品多选框按钮
      Returnchecked: false,
      checkList: [],
      // 辅营产品人数
      productPeopleList: [],
      stateTime: "",
      endtime: "",
      changecertifi: "",
      // 新增邮寄地址
      addemailDialogVisible: false,
      // 新增邮寄地址绑定
      // 新增
      addemallway: {
        consignee: "",
        addphone: "",
        region: "",
        detailedAddress: "",
        label: "",
      },
      // 常用邮寄地址
      mailingddressList: [],
      // 下拉菜单绑定地址
      selectAddressVal:"",
      way: {
        invoice: "",
      },
      wayRules: {
        Airvalue: [
          {
            required: true,
            message: "请选择取票地点",
            trigger: "change",
          },
        ],
        delivery: [
          {
            required: true,
            message: "请输入配送方式",
            trigger: "change",
          },
        ],
      },
      loading: false,
      // 添加乘客
      showBox: false,
      passengers: false,
      Querydata:{
        phoneOne: this.$route.phone ? this.$route.phone : "",
        cardCode: ""
      },
      // 查询会员
      memberData: {
        phoneOne: "",
        userName: "",
        certificateType: "",
        cardCode: "",
        customerId: null,
      },
      messageRules: {
        phone: [
          {
            required: true,
            message: "请输入手机号",
            trigger: "change",
            pattern: "/^1[2-9]d{9}$/",
          },
        ],
      },
      // 其他选项
      otheroptions: {
        remark: "",
        attention: "",
        checkValue: "",
      },
      otherValue: [
        {
          value: "0",
          label: "请出电子客票",
        },
        {
          value: "1",
          label:
            "客人暂定，等通知出票，通知出票时务必查看是否有次此折扣，请与客人核实预定信息",
        },
      ],
      // 筛选出生日期
      TimeYear: "",
      TimeMonth: "",
      Timeday: "",
      // 支付方式
      mode: {},
      model: [],
      radioList: [],
      flightMes: {},
      flightReTurnMes:{},
      money: 0,
      orderMes: {},
      objPnr: {
        orderId: null,
      },
      // 会员信息查询
      message: {
        phone: "",
      },
      //页面显示乘机人列表 最终下单的旅客列表
      userList: [],
      chooseList: [], //最终下单的旅客列表
      chooseDownStatus:[],
      chooseSexInpStatus:[],
      chooseBirthDayStatus:[],
      Frequenflyer: [], //常用旅客列表
      ReactName: "", //联系信息姓名
      phoneNum: null, //联系信息手机号
      pncList: [], //生成命令返回数据
      // 注册证件类型
      certificate: [
        {
          value: "ZGJMSFZ",
          label: "中国居民身份证",
        },
        {
          value: "MILITARY",
          label: "军官证",
        },
        {
          value: "BIRTH",
          label: "出生医学证明（二周岁以下）",
        },
        {
          value: "HKB",
          label: "户口薄（十六周岁以下）",
        },
        {
          value: "GATJMJZZ",
          label: "港澳台居民居住证",
        },
        {
          value: "GAJMLWNDTXZ",
          label: "港澳通行证（包括电子港澳通行证）",
        },
        {
          value: "TWJMLWDLTXZ",
          label: "台湾居民来往大陆通行证",
        },
        {
          value: "HZ",
          label: "护照",
        },
        {
          value: "DZHZ",
          label: "电子护照",
        },
        {
          value: "WGRYJJLSFZ",
          label: "外国人永久居留身份证",
        },
        {
          value: "OTHER",
          label: "其他证件",
        },
      ],
      item: {},
      labelwidth: "67px",
      //配送方式
      shipvalue: "",
      payment: "",
      pays: "",
      depositcard: false,
      bankcard: false,
      shipList: [
        {
          value: "airportTicket",
          label: "机场取票",
        },
        {
          value: "postTicket",
          label: "邮寄客票",
        },
        {
          value: "reservedItinerary",
          label: "保留行程单",
        },
        {
          value: "notItinerary",
          label: "无需行程单",
        },
        // {
        //   value: "invoice",
        //   label: "发票",
        // },
      ],
      // 联系信息
      relation: {
        ReactName: "",
        phoneNum: "",
      },
      relationrules: {
        ReactName: [
          {
            required: true,
            message: "请输入姓名",
            trigger: "change",
          },
        ],
        phoneNum: [
          {
            required: true,
            message: "请输入手机号",
            trigger: "change",
          },
        ],
      },
      // 新增邮寄地址
      addemailrules: {
        consignee: [
          {
            required: true,
            message: "请输入持卡人姓名",
            trigger: "change",
          },
        ],
        label: [
          {
            required: true,
            message: "请输入标签",
            trigger: "change",
          },
        ],
        addphone: [
          {
            required: true,
            message: "请输入手机号",
            trigger: "change",
          },
        ],
        region: [
          {
            required: true,
            message: "请输入地址",
            trigger: "change",
          },
        ],
        detailedaddress: [
          {
            required: true,
            message: "请输入详细地址",
            trigger: "change",
          },
        ],
      },
      airline: {},
      createPNR: {},
      showExpress: false,
      showAirport: false,
      showRetain: false,
      textarea: "", //发票备注
      Airvalue: "",
      AirList: [], //机场取票
      GoSearchWhere: this.$route.params.GoSearchWhere,
      priceObj:{},
      orders: this.$route.params.orders,
      flight: {},
      flights: {},
      BreadCrumb: [
        {
          path: "/flight/reserve",
          name: "机票查询",
        },
        {
          path: "/reserve/flightschedule",
          name: "机票填写",
        },
      ],
      cabin: "Y",
      type: this.$route.params.type,
      options: [],
      checked: false,
      value: "",
      input: "",
      typeindex: "",
      pattern: {
        names: "",
        phone: "",
        cardType: "",
        payment: "",
        pays: "",
        address: "",
        userName: "",
        cardNumber: "",
        cardId: "",
        cvv: "",
        period: "",
      },
      ListMoPassenger: [],
      // 去程
      ListGoSegment: [],
      // 返程
      ListBackSegment: [],
      // 选中通用产品价格
      productcurrentprice: [],
      // 通盈产品id
      productId: "",
      // 退改签机票详情主键
      flightMesindex: "",
      shipvalueprivk: 0,
    };
  },
  watch: {
    // 监听配送方式
    shipvalue(nV, oV) {
      this.selectAddressVal = "";
      this.$set(this.deliverAssign,"contactAddress",null);
      this.$set(this.deliverAssign,"contactPostcode",null);
      this.$set(this.deliverAssign,"contactName",null);
      this.$set(this.deliverAssign,"contactPhone",null);
      this.$set(this.deliverAssign,"deliverType",nV);
      if (nV == "postTicket") {
        this.showExpress = true;
        this.showAirport = false;
        this.showRetain = false;
        this.fapiao = false;
        this.shipvalueprivk = 10;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 10;
      } else if (nV == "airportTicket") {
        this.showAirport = true;
        this.showRetain = false;
        this.showExpress = false;
        this.fapiao = false;
        this.shipvalueprivk = 0;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 0;
        this.flightTicketList();
      } else if (nV == "reservedItinerary") {
        this.showRetain = true;
        this.showExpress = false;
        this.showAirport = false;
        this.fapiao = false;
        this.shipvalueprivk = 0;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 0;
      } else if (nV == "notItinerary") {
        this.showExpress = false;
        this.showAirport = false;
        this.showRetain = false;
        this.fapiao = false;
        this.shipvalueprivk = 0;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 0;
      } else if (nV == "invoice") {
        this.fapiao = true;
        this.showExpress = false;
        this.showAirport = false;
        this.showRetain = false;
        this.shipvalueprivk = 0;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 0;
      }else{
        this.fapiao = false;
        this.showExpress = false;
        this.showAirport = false;
        this.showRetain = false;
        this.shipvalueprivk = 0;
        this.GoSearchWhere.price = this.GoSearchWhere.price + 0;
      }
    },
    userList: {
      handler(nV, oV) {
        console.log(nV);
        if (nV.length > 0) {
          this.relation.ReactName = this.userList[0].passName;
          this.relation.phoneNum = this.userList[0].passPhone;
        }
      },
      deep: true,
    },
  },
  filters:{
    certificateValue(val){
      if(val==="ZGJMSFZ")return "中国居民身份证";
      if(val==="MILITARY")return "军官证";
      if(val==="BIRTH")return "出生医学证明";
      if(val==="HKB")return "户口薄";
      if(val==="OTHER")return "其他证件";
      if(val==="GATJMJZZ")return "港澳台居民居住证";
      if(val==="GAJMLWNDTXZ")return "港澳居民来往内地通行证";
      if(val==="TWJMLWDLTXZ")return "台湾居民来往大陆通行证";
      if(val==="HZ")return "护照";
      if(val==="DZHZ")return "电子护照";
      if(val==="WGRYJJLSFZ")return "外国人永久居留身份证";
    },
  },
  methods: {
    priceSum(selectIndex) {
      console.log(selectIndex)
      // 成人价格
      let titckPrice=this.priceObj.wherePrice.titckPrice;
      let airportTax=this.priceObj.wherePrice.airportTax;
      let fuelTax=this.priceObj.wherePrice.fuelTax;
      let adultPriceSum = titckPrice+airportTax+fuelTax;
      // 儿童价格
      let childPrice= this.priceObj.wherePrice.childPrice;
      let childAirportTax= this.priceObj.wherePrice.childAirportTax;
      let childFuelTax=this.priceObj.wherePrice.childFuelTax;
      let childPriceSum = childPrice+childAirportTax+childFuelTax;
      // 婴儿价格
      let bodyPrice =this.priceObj.wherePrice.bodyPrice;
      let bodyAirportTax= this.priceObj.wherePrice.bodyAirportTax;
      let bodyFuelTax= this.priceObj.wherePrice.bodyFuelTax;
      let bodyPriceSum = bodyPrice+bodyAirportTax+bodyFuelTax;
        // 往返票价格及各票费合计
      if(this.type == "return"){
        let backPrice = this.priceObj.returnPrice.backPrice;
        let childBackprice = this.priceObj.returnPrice.childBackprice;
        let bodybackprice =  this.priceObj.returnPrice.bodybackprice;
        adultPriceSum+=(backPrice+airportTax+fuelTax);
        childPriceSum+=(childBackprice+childAirportTax+childFuelTax);
        bodyPriceSum+=(bodybackprice+bodyAirportTax+bodyFuelTax);
      }
      this.sumprice = 0;
      if(!this.userList.length) return;
      this.userList.forEach((item,index)=>{
        this.relation.ReactName = this.userList[0].passName;
        this.relation.phoneNum = this.userList[0].passPhone;
        if (this.type == "where" || this.type == "return"){
          this.sumprice+=this.productcurrentprice[index];
          if(this.type == "return") this.sumprice+=this.productcurrentprice[index];
          if (item.passType == "children") {
            this.sumprice +=childPriceSum;
          } else if (item.passType == "baby") {
            this.sumprice +=bodyPriceSum;
          } else {
            this.sumprice +=adultPriceSum;
          }
        }
      })
    },
    // 价格初始化
    priceInit(){
        // 涉及到所有价格变量
        let GoSearchWhere = this.GoSearchWhere,
            flight = this.flight;
        // 成人价格
        let titckPrice=GoSearchWhere.price;
        let airportTax=flight.airportTax;
        let fuelTax=flight.fuelTax;
        // 儿童价格
        let childPrice=GoSearchWhere.CabinMessage.chdPrice?GoSearchWhere.CabinMessage.chdPrice:titckPrice;
        let childAirportTax=GoSearchWhere.CabinMessage.chdPrice?flight.childAirportTax*1:airportTax;
        let childFuelTax=GoSearchWhere.CabinMessage.chdPrice?flight.childFuelTax*1:fuelTax;
        // 婴儿价格
        let bodyPrice = GoSearchWhere.CabinMessage.infTicketPrice?GoSearchWhere.CabinMessage.infTicketPrice:titckPrice;
        let bodyAirportTax= GoSearchWhere.CabinMessage.infTicketPrice?flight.infantAirportTax*1:airportTax;
        let bodyFuelTax= GoSearchWhere.CabinMessage.infTicketPrice?flight.infantFuelTax*1:fuelTax;
        this.$set(this.priceObj,"wherePrice",{
          titckPrice,
          airportTax,
          fuelTax,
          childPrice,
          childAirportTax,
          childFuelTax,
          bodyPrice,
          bodyAirportTax,
          bodyFuelTax
        })
        // 往返票价格及各票费合计
        if(this.type == "return"){
          let BackSearchWhere = this.BackSearchWhere;
          let backPrice = BackSearchWhere.CabinMessage.price;
          let childBackprice = BackSearchWhere.CabinMessage.chdPrice?BackSearchWhere.CabinMessage.chdPrice:backPrice;
          let bodybackprice =  BackSearchWhere.CabinMessage.infTicketPrice?BackSearchWhere.CabinMessage.infTicketPrice:backPrice;
          this.$set(this.priceObj,"returnPrice",{
            backPrice,
            airportTax,
            fuelTax,
            childBackprice,
            childAirportTax,
            childFuelTax,
            bodybackprice,
            bodyAirportTax,
            bodyFuelTax
          })
        }
        
       this.sumprice = 0;

    },
    // 国籍
    selectFnCountry(data,index,key){
      this.userList[index][key] = data;
      console.log(this.userList)
    },
    // 注册按钮
    registerMethod() {
      this.registerdialogVisible = true;
    },
    // 注册确定按钮
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$axios.getqueryCustomer({
            phone: this.ruleForm.phoneOne,
          }).then((res) => {
              if (res.code == "00000") {
                if (res.data == null) {
                  this.getregister();
                } else {
                  this.$message({
                    message:
                      "当前手机号已注册会员，请直接使用或换其他手机号进行注册",
                    type: "warning",
                  });
                }
              }
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 会员注册接口
    getregister() {
      this.$axios.getregister(this.ruleForm).then((res) => {
        // console.log(res);
        if (res.code == "00000") {
          this.$message({
            message: "会员注册成功",
            type: "success",
          });
          this.registerdialogVisible = false;
        }
      });
    },
    asdfasdfsdfsf() {
      // console.log("fsnioldefgkujlsjdngksdf")
      this.passengers = false;
    },
    // 取消pnr按钮
    cancelpnr() {
      if (this.objPnr.pnr) {
        this.cancelwindow = true;
      } else {
        this.$message({
          message: "请先生成预定后在取消",
          type: "warning",
        });
      }
    },
    // 确定取消pnr按钮
    determinecancelpnrpnr() {
      this.$axios
        .getcancelPNR({
          pnr: this.objPnr.pnr,
        })
        .then((res) => {
          if (res.code == "00000"&& res.data.IsSuccess) {
            this.cancelwindow = false;
            this.$message({
              message: "取消pnr成功",
              type: "success",
            });
            this.objPnr={};
          }else{
            this.$message({
              message:"取消pnr失败",
              type: "success",
            });
          }
        });
    },

    //两个时间相差天数 兼容firefox chrome
    datedifference1(sDate1, sDate2) {
      //sDate1和sDate2是2006-12-18格式
      var dateSpan, tempDate, iDays;
      sDate1 = Date.parse(sDate1);
      sDate2 = Date.parse(sDate2);
      dateSpan = sDate1 - sDate2; // dateSpan = Math.abs(dateSpan);
      iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
      return iDays;
    },

    // 通用产品选中事件(乘机人信息,辐营产品,辐营产品下标)
    productcurrent(val,row,index) {
      this.productcurrentprice[index] = 0;
      let productItemTable = this.$refs['productItemTable'+index][0]
      productItemTable.clearSelection();
      if(row.productType === "insurance"){
        val = val.filter((item)=>{
          if(item.productType === "insurance"){
            if(item.id === row.id) return item
          }else{
            return item
          }
        })
      }
      val.forEach((item)=>{
        productItemTable.toggleRowSelection(item);
        this.productcurrentprice[index] += item.salesMoney;
      })
      this.priceSum(index)
      this.$set(this.userList[index],'checkList',val)
    },

    changecertificateNumcer(row) {
      console.log(row);
      this.changecertifi = row;
      console.log(this.changecertifi);
    },
    openAddemailDialogVisible(){
      if(!this.memberData.customerId){
       this.prompt();
        return
      }
      this.addemailDialogVisible = true
    },
    // 新增邮寄地址
    getbackInsertAddresses() {
      // debugger
      
      if (this.addemallway.consignee == "") {
        this.$message({
          message: "请先填写邮寄地址信息！",
          type: "warning",
        });
      } else {
        this.$axios
          .getaddUserAddress({
            userName: this.addemallway.consignee,
            phone: this.addemallway.addphone,
            userAddress: this.addemallway.region,
            addressDetailed: this.addemallway.detailedAddress,
            addressTable: this.addemallway.label,
            userId: this.memberData.customerId,
          })
          .then((res) => {
            console.log(res);
            if (res.code == "00000") {
              this.$message({
                message: "新增成功",
                type: "success",
              });
              this.getqueryUserAddressList()
              this.addemailDialogVisible = false;
            }
          });
      }
    },
    // 修改票价点击事件
    editTicketPriceMethod() {
      if (this.userList.length == 0) {
        this.$message({
          message: "请先添加乘客",
          type: "warning",
        });
      } else {
        this.editTicketPriceDiloag = true;
      }
    },

    paysChange(index) {
      this.typeindex = index;
      // if(this.typeindex==0){
      //   this.typeindex='1'
      // }
      if (this.pattern.pays == "0") {
        this.depositcard = true;
        this.bankcard = false;
      } else if (this.pattern.pays == "1") {
        this.depositcard = false;
        this.bankcard = true;
      } else {
        this.depositcard = false;
        this.bankcard = false;
      }
    },
    getset2(val) {
      var timez = val.split(" ");
      var array = timez[1];
      return array;
    },
    getset3(val) {
      var timez = val.split(" ");
      var array = timez[0];
      return array;
    },

    getweekday(date) {
      var weekArray = new Array(
        "周日",
        "周一",
        "周二",
        "周三",
        "周四",
        "周五",
        "周六"
      );
      var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
      // if(week == )
      var tod = weekArray[new Date().getDay()];
      return week;
    },
    //显示添加乘客弹窗
    showBoxBtn() {
      if (this.cabinLeftDesc != "座位充足") {
        if (this.userList.length >= Number(this.cabinLeftDesc)) {
          this.$message({
            dangerouslyUseHTMLString: true,
            message: "乘机人员最多可添加" + this.cabinLeftDesc + "人！",
            type: "warning",
          });
          return;
        }
      } else {
        if (this.userList.length >= 9) {
          this.$message({
            message: "乘机人员最多可添加9人！",
            type: "warning",
          });
          return;
        }
      }
      if (this.objPnr.pnr != null) {
        this.$message({
          message: "PNR已生成，不可修改乘机人！",
          type: "warning",
        });
        return;
      }
      if (this.memberData.userName == "") {
        this.prompt();
      } else {
        this.showBox = true;
        var params = {};
        params.passName = "";
        params.commonTrvelersId = "";
        params.documents = {};
        params.passPhone = "";
        params.englishName = "";
        params.englishSurname = "";
        params.gender = "";
        params.name = null;
        params.is = false;
        params.myself = "";
        params.product = this.selectReturnData;
        params.passType = "";
        params.certificateName = "";
        params.certificateNumber = "";
        params.certificateDate = "";
        params.certificateType = "";
        params.commontrvelersId = "";
        params.checkList = [];
        // params.passengerDocumentsId = 0;
        this.userList.push(params);
        this.chooseList.push(params);
        this.chooseDownStatus.push(false);
        this.chooseSexInpStatus.push(true);
        this.chooseBirthDayStatus.push(true);
        this.productcurrentprice.push(0)
        this.priceSum();
        this.$forceUpdate()
      }

      if (this.memberData.userName == "") {
        this.$message({
          message: "请先查询会员消息！",
          type: "warning",
        });
      } else {
      }
    },

    // 右侧航班详情显示日期
    getseyears(num) {
      console.log(num);
      if (num == null || num == undefined || num == "") {
        return "";
      } else {
        var arr = num.split(" ");
        var time = arr[0].split("-");
        var times = time[1] + "月" + time[2] + "日";
        this.TimeYear = time[0];
        this.TimeMonth = time[1];
        this.Timeday = time[2];
        return times;
      }
    },
    //乘客删除按钮
    handelDelet(item, index) {
      if (this.objPnr.pnr != null) {
        this.$message({
          message: "pnr已生成，请取消pnr后在进行修改",
          type: "warning",
        });
      } else {
        this.userList.splice(index, 1);
        this.chooseList.splice(index, 1);
        this.chooseDownStatus.splice(index, 1);
        this.chooseSexInpStatus.splice(index, 1);
        this.chooseBirthDayStatus.splice(index, 1);
        this.ListMoPassenger.splice(index, 1);
        this.productcurrentprice.splice(index, 1);
        this.priceSum()
      }
    },
    //查看详情
    showDetail(item, index) {
      console.log(item, index);
    },
    //点击生成预定命令弹窗
    confirmed() {
      if (this.userList.length < 1) {
        this.prompt1();
      } else {
        if (this.relation.ReactName != "" && this.relation.phoneNum != "") {
          this.isNeedPinyin();
          // this.getcreatePNRed()
        } else {
          this.$message({
            message: "请填写联系信息姓名及手机号！",
            type: "warning",
          });
        }
      }
    },
    canceled() {},
    // 单程航班详情
    getflightDetails(mes) {
      this.showLoading();
      console.log(mes);
      let GoSearchWhere = {
        DepDate: mes.DepDate,
        DstAirport: mes.DstAirport,
        FlightNo: mes.FlightNo,
        OrgAirport: mes.OrgAirport,
        channelType: mes.channelType,
      };
      this.$axios
        .getNewflightDetails({
          GoSearchWhere: GoSearchWhere,
          hasChildren: mes.hasChildren,
          hasBaby: mes.hasBaby,
          TripType: mes.TripType,
          transferId: "",
        })
        .then((res) => {
          this.closeLoading();
          if (res.code == "00000") {
            if (res.data.length == 1) {
              this.flight = res.data[0];
              this.priceInit()
            } else {
            }
          }
        });
    },
    // 往返航班详情
    getflightReturn(mes, mes1) {
      this.showLoading();
      console.log(mes, mes1);
      let GoSearchWhere = {
        DepDate: mes.DepDate,
        DstAirport: mes.DstAirport,
        FlightNo: mes.FlightNo,
        OrgAirport: mes.OrgAirport,
        channelType: mes.channelType,
      };
      let BackSearchWhere = {
        DepDate: mes1.DepDate,
        DstAirport: mes1.DstAirport,
        FlightNo: mes1.FlightNo,
        OrgAirport: mes1.OrgAirport,
        channelType: mes1.channelType,
      };
      this.$axios
        .getflightReturn({
          GoSearchWhere: GoSearchWhere,
          BackSearchWhere: BackSearchWhere,
          hasChildren: mes.hasChildren,
          hasBaby: mes.hasBaby,
          TripType: "roundTrip",
          transferId: "",
        })
        .then((res) => {
          this.closeLoading();
          if (res.code == "00000") {
            console.log(res);
            this.flight = res.data[0];
            this.flights = res.data[1];
            console.log(this.flight, this.flights);
            this.stateTime = this.getweekday(
              this.getset3(res.data[0].arrDate)
            );
            this.endtime = this.getweekday(
              this.getset3(res.data[1].arrDate)
            );
            this.priceInit()
          }
        });
    },
    sub(val) {
      return val.slice(0, 3);
    },
    airport(val) {
      return val.slice(0, 2);
    },
    // 生成预定指令前判断是否需要拼音
    isNeedPinyin() {
      let isPinyi = 0;
      for (let i = 0; i < this.userList.length; i++) {
        if (
          this.userList[i].passType == "baby" ||
          this.userList[i].certificateType == "PASSPORT"
        ) {
          isPinyi = 1;
        }
      }
      this.getcreatePNRed();
    },
    // 获取年龄
    getAge(birthday) {
      //出生时间 毫秒
      var birthDayTime = new Date(birthday).getTime();
      //当前时间 毫秒
      var nowTime = new Date().getTime();
      //一年毫秒数(365 * 86400000 = 31536000000)
      return Math.ceil((nowTime - birthDayTime) / 31536000000);
    },
    //生成预定命令
    getcreatePNRed() {
      console.log(1);
      let obj = this.GoSearchWhere;
      let obj1 = {};
      if(this.BackSearchWhere) obj1 = this.BackSearchWhere;
      this.ListMoPassenger = [];
      this.userList.forEach((item) => {
        let objChild = {
          Birthday: item.birthday + " 00:00:00",
          PassengerName: item.passName,
          IDType: item.certificateType,
          IDNO: item.certificateNumber,
          PassengerType: item.passType,
          PassengerMobile: item.passPhone,
          Cabin: obj.cabin,
          baggage: obj.CabinMessage.baggage,
          Sex: item.passSex == "male",
          age: this.getAge(item.birthday),
          // ancillaryProducts: item.checkList.map(item=>item.id)
        };
        if(this.type == "return"){
          if(this.type == "return") objChild["backBaggage"]= obj1.CabinMessage.baggage;
          if(this.type == "return") objChild["backCabin"]= obj1.cabin;         
        }
        if(item.certificateType !=="ZGJMSFZ"){
          objChild["englishName"] =item.englishName;
          objChild["englishSurname"] =item.englishSurname;
          objChild["nationality"] =item.nationality;
          objChild["docHolderInd"] =item.docHolderInd;
          objChild["docIssueCountry"] =item.docIssueCountry;
          objChild["IDValidDate"] =item.IDValidDate+" 00:00:00";
        }
        this.ListMoPassenger.push(objChild);
      });
      let arr = this.flight;
      if (this.type == "where") {
        let objs = {
          DstAirport: arr.dstAirport,
          OrgAirport: arr.orgAirport,
          orgTerminal: arr.depTerm,
          dstTerminal: arr.arrTerm,
          Airline: this.airport(arr.flightNo),
          ArrDate: arr.arrDate.split(" ").join(" ") + ":" + "00",
          DepDate: arr.depDate.split(" ").join(" ") + ":" + "00",
          FlightNo: arr.flightNo,
          actFlightNo: obj.actFlightNo ? obj.actFlightNo : "",
          PlaneStyle: arr.planeStyle ? this.sub(arr.planeStyle) : "",
          Cabin: obj.cabin ? obj.cabin : "",
        };
        this.ListGoSegment[0]=objs;
        this.getcreatePNR(this.ListGoSegment, this.ListMoPassenger);
        return;
      } else if (this.type == "return") {
        // debugger
        let arr1 = this.flights;
        let objs = {
          DstAirport: arr.dstAirport,
          OrgAirport: arr.orgAirport,
          orgTerminal: arr.depTerm,
          dstTerminal: arr.arrTerm,
          Airline: this.airport(arr.flightNo),
          ArrDate: arr.arrDate.split(" ").join(" ") + ":" + "00",
          DepDate: arr.depDate.split(" ").join(" ") + ":" + "00",
          FlightNo: arr.flightNo,
          actFlightNo: obj.actFlightNo ? obj.actFlightNo : "",
          PlaneStyle: arr.planeStyle ? this.sub(arr.planeStyle) : "",
          Cabin: obj.cabin ? obj.cabin : "",
        };
        let objss = {
          DstAirport: arr1.dstAirport,
          OrgAirport: arr1.orgAirport,
          orgTerminal: arr.depTerm,
          dstTerminal: arr.arrTerm,
          Airline: this.airport(arr1.flightNo),
          ArrDate: arr1.arrDate.split(" ").join(" ") + ":" + "00",
          DepDate: arr1.depDate.split(" ").join(" ") + ":" + "00",
          FlightNo: arr1.flightNo,
          actFlightNo: obj1.actFlightNo ? obj1.actFlightNo : "",
          PlaneStyle: arr1.planeStyle ? this.sub(arr1.planeStyle) : "",
          Cabin: obj1.cabin ? obj1.cabin : "",
        };
        this.ListGoSegment[0]=objs;
        this.ListBackSegment[0]=objss;
        this.getcreatePNR(
          this.ListGoSegment,
          this.ListMoPassenger,
          this.ListBackSegment
        );
      } else {
      }
    },
    // 指令生成
    getcreatePNR(ListGoSegment, ListMoPassenger, ListBackSegment) {
      this.loading = true;
      let obj = this.GoSearchWhere;
      let arr = this.flight;
      if (this.type == "where") {
        this.$axios
          .getcreatePNR({
            ListGoSegment,
            TripType: "oneWay",
            ListMoPassenger,
            orderSource: "crm",
            stopCount: arr.stopCount,
            channelType: this.flight.channelType,
            expectOutTime: ListGoSegment[0].DepDate + " 00:00:00",
            Contacts: {
              ContactName: this.relation.ReactName,
              ContactMobile: this.relation.phoneNum,
            },
          })
          .then((res) => {
            console.log(res);
            this.loading = false;
            if (res.code == "00000" && res.data.hasSuccess) {
              this.loading = false;
              this.pncList = res.data;
              this.objPnr = res.data;
            } else {
              this.$message({
                message:res.data.msg || res.msg,
                type: 'error'
              });
              this.loading = false;
              // this.ListMoPassenger=[]
            }
          });
      } else if (this.type == "return") {
        this.$axios
          .getcreatePNR({
            ListGoSegment: ListGoSegment,
            TripType: "roundTrip",
            orderSource: "crm",
            ListMoPassenger: ListMoPassenger,
            channelType: this.flight.channelType,
            ListBackSegment: ListBackSegment,
            expectOutTime: ListGoSegment[0].DepDate + " 00:00:00",
            IsNeedPost: false,
            Contacts: {
              ContactName: this.relation.ReactName,
              ContactMobile: this.relation.phoneNum,
            },
          })
          .then((res) => {
            console.log(res);
            this.loading = false;

            if (res.code == "00000" && res.data.hasSuccess) {
              this.loading = false;
              this.pncList = res.data;
              this.objPnr = res.data;
            } else {
              this.$message({
                message:res.data.msg || res.msg,
                type: 'error'
              });
              this.loading = false;
            }
          });
      } else {
        this.$axios
          .getcreatePNR({
            ListGoSegment: ListGoSegment,
            TripType: "oneWay",
            ListMoPassenger: ListMoPassenger,
            channelType: this.flight.channelType,
            orderSource: "crm",
          })
          .then((res) => {
            console.log(res);
            this.loading = false;
            if (res.code == "00000" && res.data.hasSuccess) {
              if(res.data.hasSuccess){
                 this.loading = false;
              this.pncList = res.data;
              this.objPnr = res.data;
              }else{
                this.$message({
                  message:res.data.msg || res.msg,
                  type: 'error'
                });
              }
            } else {
              this.loading = false;
            }
          });
      }
    },

    //取消订座
    cancelOrder() {
      // this.$axios.getcancelFlightOrder({}).then((res) => {
      //   console.log(res);
      //   if (res.code == "00000") {
      //     this.pncList = [];
      //   }
      // });
    },

    //会员信息查询
    getqueryCustomer() {
      // debugger
      let phone = this.Querydata.phoneOne;
      var reg_tel =
        /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
      if (
        this.Querydata.phoneOne != "" ||
        this.Querydata.cardCode != ""
      ) {
        this.$axios
          .getqueryCustomer({
            phone: this.Querydata.phoneOne,
            vipNumber: this.Querydata.cardCode,
          }).then((res) => {
            if (res.code == "00000" && res.data) {
              this.memberData.userName = res.data.userName;
              this.memberData.customerId = res.data.id;
              this.memberData.cardCode = res.data.userCardBO.cardNumber;
              this.memberData.cardInfo = res.data.userCardBO;
              this.memberData.passenInfo = res.data.userPassengerBO;
              this.memberData.phoneOne =  res.data.userAccount;
              this.memberData.remark = res.data.remark;
              this.getqueryUserAddressList();
            }else{
              this.$confirm('查询失败,当前账号不存在！！', '提示', {
                confirmButtonText: '确定',
                type: 'warning'
              })
            }
          });
      } else {
        // this.prompt2();
        this.$message({
          message: "请输入手机号或者会员卡号进行查新",
          type: "warning",
        });
      }
    },

    //清空
    reset(formName) {
      this.$refs[formName].resetFields();
    },

    prompt() {
      this.$confirm("请查询会员信息", "提示", {
        confirmButtonText: "确定",
        type: "warning",
      });
    },

    prompt1() {
      this.$confirm("请选择乘客", "提示", {
        confirmButtonText: "确定",
        type: "warning",
      })
        .then((res) => {})
        .catch((err) => {});
    },
    //显示选择常旅客弹窗
    passengersBtn() {
      // debugger
      this.passengers = true;
      let phone;
      var reg_tel =
        /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
      if (this.memberData.customerId == null) {
        this.prompt();
        this.passengers = false;
      } else {
        this.getbankCommonTravelers(String(this.memberData.customerId));
        if (this.objPnr.pnr != null) {
          this.$message({
            message: "PNR已生成，不可修改乘机人！",
            type: "warning",
          });
          // return;
        }
        if (this.userList.length >= 9) {
          this.$message({
            message: "乘机人员最多可添加9人！",
            type: "warning",
          });
          return;
        }
      }
    },

    //确定常旅客
    Addpassengers() {
      if(!this.chooseList[0].passName){
        this.$message({
          message: "请添加乘机人",
          type: "warning",
        });
        this.passengers = false;
        return
      }
      let length = this.userList.length
      this.chooseList.forEach((item,index) => {
        let arr = [];
        let arrEnglish = [];
        this.chooseDownStatus[length+index]=false;
        this.chooseSexInpStatus[length+index]=true;
        this.chooseBirthDayStatus[length+index]=true;
        this.productcurrentprice[length+index]=0;
        if(item.certificateType == "ZGJMSFZ") this.chooseDownStatus[length+index] = false;
        if(item.certificateType == "ZGJMSFZ") this.chooseSexInpStatus[length+index] = false;
        if(item.certificateType == "ZGJMSFZ") this.chooseBirthDayStatus[length+index] = false;
        if(item.certificateType == "BIRTH") this.chooseDownStatus[length+index] = false;
        if(item.certificateType == "BIRTH") this.chooseSexInpStatus[length+index] = false;
        if(item.certificateType == "OTHER") this.chooseDownStatus[length+index] = false;
        if(item.certificateType == "GATJMJZZ") this.chooseDownStatus[length+index] = false;
        arr.push(item);
        arr.forEach((item) => {
          var found = false;
          for (let j = 0; j < this.userList.length; j++) {
            if (
              item.certificateNumber ==
              this.userList[j].certificateNumber
            ) {
              found = true;
              this.$message({
                message: "当前乘机人已存在",
                type: "warning",
              });
            } else {
              item.is = false;
              
              item.product = this.selectReturnData;
              item.checkList = [];
            }
          }
          if (!found) {
            item.checkList = [];
            arrEnglish = Pinyin.getFullChars(item.passName).match(
              /[A-Z][a-z]+/g
            );
            item.englishSurname = arrEnglish[0];
            arrEnglish.splice(0, 1);
            item.docIssueCountry = item.nationality;
            item.IDValidDate = item.certificateDate;
            item.englishName = arrEnglish.join("");
            this.userList.push(item);
            this.priceSum()
          }
        });
      });
      this.passengers = false;
    },
    // 选择已有邮寄地址进行相应赋值
    changeAddressVal(val){
      let selObj = this.mailingddressList.filter((item)=>{
        if(item.detailedAddress === val) return item;
      })[0]
      console.log(selObj)
      this.$set(this.deliverAssign,"contactAddress",val);
      this.$set(this.deliverAssign,"contactPostcode",null);
      this.$set(this.deliverAssign,"contactName",selObj.userName);
      this.$set(this.deliverAssign,"contactPhone",selObj.phone);

      console.log(val);
    },
    getqueryUserAddressList(){
      this.$axios.getqueryUserAddressList({
        userId:this.memberData.customerId
      }).then((res)=>{
        if(res.code == "00000"){
          res.data.forEach((item)=>{
            item.detailedAddress = item.userAddress + item.addressDetailed
            this.mailingddressList.push(item)
          })
          
        }
        console.log(res)
      })
    },
    // 机票常用旅客接口
    getbankCommonTravelers(id) {
      console.log(id);
      this.$axios
        .getbankCommonTravelers({
          userId: id,
        })
        .then((res) => {
          if (res.code == "00000") {
            console.log(res);
            // 工单列表数据
            this.Frequenflyer = res.data;
            let arr = this.selectReturnData;
            arr.forEach((item) => {
              item.is = false;
            });
            let hasChildren = this.GoSearchWhere.hasChildren
            let hasBaby = this.GoSearchWhere.hasBaby
            if(!hasChildren){
              this.Frequenflyer=this.Frequenflyer.filter((item)=>{
                if(item.passType !== 'children') return item
              })
            }
            if(!hasBaby){
              this.Frequenflyer=this.Frequenflyer.filter((item)=>{
                if(item.passType !== 'baby') return item
              })
            }
            this.Frequenflyer.forEach((item) => {
              item.is = false;
              item.product = this.selectReturnData;
            });
          }
        });
    },

    handleClose() {},

    //选中的常旅客
    handleSelectionChange(val) {
      this.chooseList = val;
      this.chooseList.filter((item, index, arr) => {
        if (this.chooseList.length > 1) {
          if (
            arr[index].certificateNumber !=
            arr[index + 1].certificateNumber
          ) {
          } else {
            return item;
          }
        } else {
          return item;
        }
      });
      for (let i = 0; i < this.chooseList.length; i++) {
        for (let j = 0; j < this.userList.length; j++) {
          if (
            this.chooseList[i].certificateNumber ==
            this.userList[j].certificateNumber
          ) {
            this.$message({
              message: "当前乘机人已存在",
              type: "warning",
            });
          } else {
          }
        }
      }
    },
    passNameChange(index) {
      let Enghlish = "";
      let names = "";
      let arr = [],arr1;
      Enghlish = Pinyin.getFullChars(this.userList[index].passName);
      arr = Enghlish.match(/[A-Z][a-z]+/g);
      arr1 = [].concat(arr)
      arr1.shift();
      this.userList[index].englishSurname = arr[0];
      this.userList[index].englishName = arr1.join("");
    },
    certificateTypeChange(index) {
      this.chooseDownStatus[index] = true;
      this.chooseSexInpStatus[index] = true;
      this.chooseBirthDayStatus[index] = true;
      if(this.userList[index].certificateType == "ZGJMSFZ") this.chooseDownStatus[index] = false;
      if(this.userList[index].certificateType == "ZGJMSFZ") this.chooseSexInpStatus[index] = false;
      if(this.userList[index].certificateType == "ZGJMSFZ") this.chooseBirthDayStatus[index] = false;
      if(this.userList[index].certificateType == "BIRTH") this.chooseDownStatus[index] = false;
      if(this.userList[index].certificateType == "BIRTH") this.chooseSexInpStatus[index] = false;
      if(this.userList[index].certificateType == "OTHER") this.chooseDownStatus[index] = false;
      if(this.userList[index].certificateType == "GATJMJZZ") this.chooseDownStatus[index] = false;
      if(this.userList[index].certificateType !== "ZGJMSFZ"){
        this.userList[index].nationality = "CN";
        this.userList[index].docIssueCountry = "CN";
      }else{
        this.userList[index].nationality = "";
        this.userList[index].docIssueCountry = "";
      }
      // this.userList[index].passType = "";
      this.userList[index].certificateNumber = "";
    },
    certificateNumcerChange(index) {
      let certificateNumber = this.userList[index].certificateNumber;
      if(certificateNumber.length > 13 && this.userList[index].certificateType === "ZGJMSFZ"){
        let birth = "" , sex="";
        birth = this.getIdCardRule(certificateNumber,1);
        if(certificateNumber.length>15) sex = this.getIdCardRule(certificateNumber,2);
        this.$set(this.userList[index],"birthday",birth)
        this.$set(this.userList[index],"passSex",sex)
        this.birthdayChange(index);
      }
    },
    //通过身份证号计算年龄、性别、出生日期
    getIdCardRule(userCard, num) {
    let birth = "";
    //获取出生日期
        if (num == 1) {
            birth = userCard.substring(6, 10) + "-" + userCard.substring(10, 12) + "-" + userCard.substring(12, 14);
            return birth;
        }
    //获取性别
        if (num == 2) {
            if (parseInt(userCard.substr(16, 1)) % 2 == 1) {
                return "male";
            } else {
                return "female";
            }
        }
    //获取年龄
        if (num == 3) {
            var myDate = new Date();
            var month = myDate.getMonth() + 1;
            var day = myDate.getDate();
            var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
            if (userCard.substring(10, 12) < month || userCard.substring(10, 12) == month && userCard.substring(12, 14) <= day) {
                age++;
            }
            return age;
        }
    },
    // 生日事件
    birthdayChange(index) {
      var ageok = 0;
      let birthday = this.userList[index].birthday;
      var date = new Date();
      var year = this.TimeYear;
      var month = this.TimeMonth;
      var day = this.Timeday;
      // var month = date.getMonth() + 1;
      // var day = date.getDate();
      month = month > 9 ? month : "0" + month;
      day = day < 10 ? "0" + day : day;
      var today = year + "-" + month + "-" + day;
      var strBirthdayArr = birthday.split("-");
      var birthYear = strBirthdayArr[0];
      var birthMonth = strBirthdayArr[1];
      var birthDay = strBirthdayArr[2];
      let ageDiff = year - birthYear; //年之差
      let dayDiff = day - birthDay;
      let montDiff = month - birthMonth;
      if(ageDiff >12 || (ageDiff>=12&&montDiff>=0&&dayDiff>=0)){
        ageok = 1
      }else if(ageDiff>2 || (ageDiff>=2&&montDiff>=0&&dayDiff>=0)){
        if(!this.GoSearchWhere.hasChildren){
          this.$message({
            message: "当前航班不支持儿童",
            type: "warning",
          });
          this.userList.splice(index, 1);
        }else {
          ageok = 3
        }
      }else{
        console.log(ageDiff);
        if (ageDiff == 0 && dayDiff < 14) {
          this.$message({
            message: "年龄小于14天的婴儿不可乘坐飞机",
            type: "warning",
          });
          this.userList.splice(index, 1);
        } else if(!this.GoSearchWhere.hasBaby){
          this.$message({
            message: "当前航班不支持婴儿",
            type: "warning",
          });
          this.userList.splice(index, 1);
        } else {
          ageok = 2;
        }
      }
      if (ageok == 1) {
        this.userList[index].passType = "adult";
      } else if (ageok == 2) {
        this.userList[index].passType = "baby";
      } else {
        this.userList[index].passType = "children";
      }
    },
    // 获取机场取票数据
    flightTicketList() {
      this.$axios
        .flightTicketList({
          depAirPortId: this.flight.orgAirport,
          arrAirportId: this.flight.dstAirport,
        })
        .then((res) => {
          if (res.code == "00000") {
            let arr = JSON.parse(JSON.stringify(res.data));
            for (let i = 0; i < arr.length; i++) {
              arr[i].id = i;
            }
            this.AirList = arr;
          }
        });
    },

    closeLoading() {
      this.tableLoading.close();
    },

    // 页面加载事件
    showLoading() {
      this.tableLoading = this.$loading({
        text: "拼命加载数据中", //显示在加载图标下方的加载文案
        spinner: "el-icon-loading", //自定义加载图标类名
        background: "rgba(0, 0, 0, 0.4)", //遮罩层颜色
        target: document.querySelector("#table"), //loadin覆盖的dom元素节点
      });
    },

    //
    getcRMnUM() {
      console.log(
        this.shipvalueprivk
      );
      this.getCRM();
      // if (this.shipvalue == "") {
      //   this.$message({
      //     message: "请选择配送方式",
      //     type: "warning",
      //   });
      // } else {}
    },
    getCRM() {
      let arr = this.userList.map((item) => {
        return item.documents;
      });
      console.log(arr);
      if (this.type == "change") {
        this.getchangeCreateOrder(this.GoSearchWhere);
      } else {
        if (this.memberData.customerId == "") {
          this.$message({
            message: "请查询会员信息",
            type: "warning",
          });
        } else if (this.userList.length < 1) {
          this.$message({
            message: "请添加乘机人",
            type: "warning",
          });
        } else if (this.objPnr.pnr == undefined) {
          this.$message({
            message: "请生成预定命令",
            type: "warning",
          });
        } else {
          this.getcreateOrderCRM(
            this.ListGoSegment,
            this.ListMoPassenger,
            this.objPnr,
            this.ListBackSegment
          );
        }
      }
    },
    //
    checkRedundant(lstData, fieldName) {
      var tmpData = {};
      for (let i = 0; i < lstData.length; i++) {
        var dataObj = lstData[i];
        if (i == 0) {
          tmpData = dataObj;
        } else {
          if (dataObj[fieldName] == tmpData[fieldName]) {
            return true;
          }
        }
      }
      return false;
    },
    getInfo(idCard) {
      let passSex = null;
      let birth = null;
      let myDate = new Date();
      let month = myDate.getMonth() + 1;
      let day = myDate.getDate();
      let nianling = 0;

      if (idCard.length === 18) {
        nianling = myDate.getFullYear() - idCard.substring(6, 10) - 1;
        passSex = idCard.substring(16, 17);
        birth =
          idCard.substring(6, 10) +
          "-" +
          idCard.substring(10, 12) +
          "-" +
          idCard.substring(12, 14);
        if (
          idCard.substring(10, 12) < month ||
          (idCard.substring(10, 12) === month &&
            idCard.substring(12, 14) <= day)
        )
          nianling++;
      }
      if (idCard.length === 15) {
        nianling = myDate.getFullYear() - idCard.substring(6, 8) - 1901;
        passSex = idCard.substring(13, 14);
        birth =
          "19" +
          idCard.substring(6, 8) +
          "-" +
          idCard.substring(8, 10) +
          "-" +
          idCard.substring(10, 12);
        if (
          idCard.substring(8, 10) < month ||
          (idCard.substring(8, 10) === month && idCard.substring(10, 12) <= day)
        )
          nianling++;
      }

      if (passSex % 2 === 0)
        passSex = 0; // 性别代码 1代表男，0代表女，暂时不涉及其他类型性别
      else passSex = 1;
      return {
        nianling,
        passSex,
        birth,
      };
    },
    // 保存机票订单信息
    getcreateOrderCRM(ListGoSegment, ListMoPassenger, objPnr, ListBackSegment) {
      let parmas = {};
      let obj = this.GoSearchWhere;
      let arr = this.flight;
      let obj1 = this.BackSearchWhere;
      let arr1 = this.flights;
      // Airvalue 取票地点
      if (this.shipvalue == "airportTicket") {
        this.deliverAssign.ticketAddress = this.Airvalue;
      }
      // 行人处理
      for (let i = 0; i < ListMoPassenger.length; i++) {
        // console.log(this.getInfo(ListMoPassenger[i].IDNO))
        this.userList.forEach((item)=>{
          if(ListMoPassenger[i].IDNO == item.certificateNumber)ListMoPassenger[i]["ancillaryProducts"] =[].concat(item.checkList.map(item=>{
            return {
              ancillaryProductsId:item.id*1
            }
          }));
        })
        console.log(ListMoPassenger[i].ancillaryProducts)
        for(let j=0;j<objPnr.listMoPassenger.length;j++){
          if(ListMoPassenger[i].PassengerName == objPnr.listMoPassenger[j].passengerName){
            ListMoPassenger[i].PsgID= objPnr.listMoPassenger[j].psgID;
          }
        }
        if(ListMoPassenger[i].PassengerType == "adult"){
          ListMoPassenger[i].TicketAmount= obj.CabinMessage.price*1;
          ListMoPassenger[i].orgPrice= obj.CabinMessage.ticketPrice*1;
          ListMoPassenger[i].AirportTax= arr.airportTax*1;
          ListMoPassenger[i].FuelTax= arr.fuelTax*1;
          if(this.type == "return") ListMoPassenger[i].backTicketAmount= obj1.CabinMessage.price*1;
          if(this.type == "return") ListMoPassenger[i].backOrgPrice= obj1.CabinMessage.ticketPrice*1;
          if(this.type == "return") ListMoPassenger[i].backAirportTax= arr1.airportTax*1;
          if(this.type == "return") ListMoPassenger[i].backFuelTax= arr1.fuelTax*1;
        }
        else if(ListMoPassenger[i].PassengerType == "children"){
          ListMoPassenger[i].TicketAmount= obj.CabinMessage.chdPrice*1;
          ListMoPassenger[i].orgPrice= obj.CabinMessage.chdTicketPrice*1;
          ListMoPassenger[i].AirportTax= arr.childAirportTax*1;
          ListMoPassenger[i].FuelTax= arr.childFuelTax*1;
          if(this.type == "return") ListMoPassenger[i].backTicketAmount= obj1.CabinMessage.chdPrice*1;
          if(this.type == "return") ListMoPassenger[i].backOrgPrice= obj1.CabinMessage.chdTicketPrice*1;
          if(this.type == "return") ListMoPassenger[i].backAirportTax= arr1.childAirportTax*1;
          if(this.type == "return") ListMoPassenger[i].backFuelTax= arr1.childFuelTax*1;
        }
        else{
          ListMoPassenger[i].TicketAmount= obj.CabinMessage.infPrice*1;
          ListMoPassenger[i].orgPrice= obj.CabinMessage.infTicketPrice*1;
          ListMoPassenger[i].AirportTax= arr.childAirportTax*1;
          ListMoPassenger[i].FuelTax= arr.infantFuelTax*1;
          if(this.type == "return") ListMoPassenger[i].backTicketAmount= obj1.CabinMessage.infPrice*1;
          if(this.type == "return") ListMoPassenger[i].backOrgPrice= obj1.CabinMessage.infTicketPrice*1;
          if(this.type == "return") ListMoPassenger[i].backAirportTax= arr1.infantAirportTax*1;
          if(this.type == "return") ListMoPassenger[i].backFuelTax= arr1.infantFuelTax*1;
        }
        ListMoPassenger[i].baggage= obj.CabinMessage.baggage;
        ListMoPassenger[i].Cabin= obj.cabin;
        ListMoPassenger[i].cabinLevel= obj.CabinMessage.baseCabin;
        ListMoPassenger[i].meal= obj.CabinMessage.meal;
        if(this.type == "return") ListMoPassenger[i].backBaggage= obj1.CabinMessage.baggage;
        if(this.type == "return") ListMoPassenger[i].backCabin= obj1.cabin;
        if(this.type == "return") ListMoPassenger[i].backCabinLevel= obj1.CabinMessage.baseCabin;
        if(this.type == "return") ListMoPassenger[i].backMeal= obj1.CabinMessage.meal;
      }
      console.log(ListMoPassenger)
      parmas = {
        ListGoSegment: ListGoSegment,
        ListMoPassenger: ListMoPassenger,
        Contacts: {
          ContactName: this.relation.ReactName,
          ContactMobile: this.relation.phoneNum,
        },
        TripType: this.type == "where" ? 'oneWay': this.type == "return" ? 'roundTrip' : '',
        expectOutTime: ListGoSegment[0].DepDate + " 00:00:00",
        ticketAmount:objPnr.totalPay,
        payamount:this.sumprice + this.shipvalueprivk,
        stopCount:this.flight.stopCount,
        channelType: this.flight.channelType,
        userId: this.memberData.customerId,
        pnr: objPnr.pnr,
        bigPnr: objPnr.bigPNR,
        orderSource:"crm",
      };
      if(this.productcurrentprice.length){
        let ancillaryProductsAmount = this.productcurrentprice.reduce((a,b)=>a+b);
        if (this.type == "return") ancillaryProductsAmount+=ancillaryProductsAmount;
        if(ancillaryProductsAmount) parmas['ancillaryProductsAmount']=ancillaryProductsAmount;
      }
      if(this.shipvalue){
        parmas["deliverAssign"]=this.deliverAssign;
      }
      // return false
      if(this.type == "return") parmas['ListBackSegment']=ListBackSegment;
      // return;
      this.showLoading();
      if (this.type == "where") {
        this.$axios.getcreateOrderCRM(parmas).then((res) => {
          this.closeLoading();
          if (res.code == "00000") {
            // debugger;
            this.orderMes = res.data;
            this.$message({
              message: "下单成功",
              type: "success",
            });
            localStorage.setItem("flyInfo",JSON.stringify({
              orderId: this.orderMes.orderId,
              GoSearchWhere: this.GoSearchWhere,
              memberData: this.memberData,
            }))
            this.$router.push({
              name: "pay",
              params: {
                orderId: this.orderMes.orderId,
                GoSearchWhere: this.GoSearchWhere,
                memberData: this.memberData,
              },
            });
          }
        });
      } else if (this.type == "return") {
        this.$axios.getcreateOrderCRM(parmas)
          .then((res) => {
            this.closeLoading();
            if (res.code == "00000") {
              // debugger;
              this.orderMes = res.data;
              localStorage.setItem("flyInfo",JSON.stringify({
                orderId: this.orderMes.orderId,
                GoSearchWhere: this.GoSearchWhere,
                memberData: this.memberData,
              }))
              this.$router.push({
                name: "pay",
                params: {
                  orderId: this.orderMes.orderId,
                  GoSearchWhere: this.GoSearchWhere,
                  memberData: this.memberData,
                },
              });
            }
          });
      }
      // this.$router.push({name:'pay',params:{orderId:'1518509931722964992'}})
    },
    // 生成改签费用
    getAirChangePrice(newobj,priceDetaile) {
        let arr = this.orders
        let priceArr = []
        priceArr = arr.map((item)=>{
            var ticketAmount = 0,airportAmount=0,fuelAmount=0
            if(item.passengerType === "adult"){
              ticketAmount = priceDetaile[0].ticketPrice - item.orderItemArr[0].ticketAmount;
              airportAmount= newobj.airportTax - item.orderItemArr[0].airportAmount;
              fuelAmount= newobj.fuelTax - item.orderItemArr[0].fuelAmount;
            }
            if(item.passengerType === "children"){
              ticketAmount = priceDetaile[0].chdPrice -  item.orderItemArr[0].ticketAmount;
              airportAmount= newobj.childAirportTax*1 - item.orderItemArr[0].airportAmount;
              fuelAmount= newobj.childFuelTax*1 - item.orderItemArr[0].fuelAmount;
            }
            if(item.passengerType === "baby"){
              ticketAmount = priceDetaile[0].infPrice - item.orderItemArr[0].ticketAmount;
              airportAmount= newobj.infantAirportTax*1 - item.orderItemArr[0].airportAmount;
              fuelAmount= newobj.infantFuelTax*1 - item.orderItemArr[0].fuelAmount;
            }
            return ticketAmount + fuelAmount + airportAmount
            
        })
        this.changePrice = priceArr[0]
    },
    // 改签航班详情
    getchangeDetails(arr) {
      this.showLoading();
      this.$axios.getchangeDetails({
        "orgAirport": arr.orgTerminal,
        "dstAirport": arr.dstTerminal,
        "ticketNo": arr.ticketNo,
        "queryDepDate": arr.departureTime,
        "passengerName": arr.passengerName,
        "passengerType": arr.passengerType,
        "channelType": arr.channelType,
        "newFlightNo": arr.newFlightNo,
        "changeCabin": arr.cabin,
      }).then((res) => {
        this.closeLoading();
          if (res.code == "00000") {
            this.$nextTick(()=>{
              console.log(res);
              this.orders[0].changeOrderitemArr = [
                res.data
              ]
              this.orders[0].orderDetaileArr = [
                res.data,
                this.orders[0].orderItemArr[0]
              ]
              this.flight = res.data;
              this.getAirChangePrice(res.data,res.data.listCabinInfo)
              this.$forceUpdate()
            })         
          }
      });
    },
    
    // 改签生成订单
    getchangeCreateOrder(arr) {
      this.showLoading();
      this.$axios
        .getchangeCreateOrder({
          orderId: arr.orderId,
          ticketNo:arr.ticketNo,
          flightNo: arr.flightNo,
          serviceAmount:this.serviceAmount,
          departureTime: arr.departureTime + ":00",
          arrTime: arr.arrTime + ":00",
          ticketAmount: arr.ticketAmount,
          cabin: arr.cabin,
          planeStyle: this.sub(arr.planeStyle),
          departureAirport: arr.orgTerminal,
          arriveAirport:arr.dstTerminal,
          orgTerminal: this.orders[0].changeOrderitemArr[0].depTerm,
          dstTerminal: this.orders[0].changeOrderitemArr[0].arrTerm,
          orderSource:"crm",
          oilFee: arr.oilFee,
          tax: arr.tax,
        })
        .then((res) => {
          this.closeLoading();
          if (res.code == "00000" && res.data.hasSuccess) {
            console.log(res);
            this.changeOrder = res.data;
            localStorage.setItem("flyInfo",JSON.stringify({
                orders: this.orders,
                price: res.data.upgradeAmount,
                orderId: res.data.orderId,
                pnr:res.data.pnr,
                type: "change",
            }))
            this.$router.push({
              name: "pay",
              params: {
                orders: this.orders,
                price: res.data.upgradeAmount,
                orderId: res.data.orderId,
                pnr:res.data.pnr,
                type: "change",
              },
            });
          }
        });
    },
    // 核对订单信息
    getchangeFlightOrder(orderId, ticketNo) {
      this.showLoading();
      this.$axios
        .getchangeFlightOrder({
          orderId: orderId,
          ticketNo: ticketNo,
        })
        .then((res) => {
          this.closeLoading();
          if (res.code == "00000") {
            console.log(res);
          }
        });
    },

    // 浮盈产品列表
    getassistProductList() {
      this.$axios
        .getassistProductList({
          businessType: "flight",
        })
        .then((res) => {
          if (res.code == "00000") {
            console.log(res);
            this.radioList = res.data;
          }
        });
    },
    // 通用浮盈产品列表接口
    getselectassistProduct() {
      this.$axios.getselectassistProduct({
        "applyModule":"flight"
      }).then((res) => {
        if (res && res.code == "00000") {
          let auxiliaryProducts = res.data;
          if (auxiliaryProducts.length < 1) {
            auxiliaryProducts.forEach((item) => {
              item.is = false;
            });
          } else {
          }
          this.selectReturnData = auxiliaryProducts;
        }
      });
    },
    inpChange(e) {
      this.$forceUpdate();
    },
  },
  mounted() {
    // debugger
    this.GoSearchWhere = this.$route.params.GoSearchWhere;
    this.cabinLeftDesc = this.$route.params.cabinLeftDesc || 9;
    if (this.type != "return") {
      this.flightMes = this.$route.params.flightMes;
      this.flightMesindex = this.$route.params.index;
      this.type = this.$route.params.type;
    }
    if (this.type == "where") {
      this.getflightDetails(this.GoSearchWhere);
      this.getselectassistProduct();
    }
    if (this.type == "return") {
      this.flightMes = this.$route.params.GoSearchWhere.CabinMessage;
      this.flightReTurnMes = this.$route.params.BackSearchWhere.CabinMessage;
      this.BackSearchWhere = this.$route.params.BackSearchWhere;
      this.getflightReturn(this.GoSearchWhere, this.BackSearchWhere);
      this.getselectassistProduct();
    }
    if (this.type == "change") {
      this.getchangeDetails(this.GoSearchWhere);
      this.item = this.$route.params.item;
      this.orders = this.$route.params.orders;
      this.userList = this.$route.params.userList;
      this.userList = [];
    }
  },
};
</script>
<style scoped>
.Ticketdetails {
  height: 100%;
  background-color: #f7f7f7;
}

.header-1 {
  width: 1050px;
  margin: auto;
  background-color: #fff;
  padding-right: 20px;
}

.tuo {
  font-weight: bolder;
  display: flex;
  line-height: 41px;
  align-items: center;
}

.two-1 > div {
  display: flex;
  margin-bottom: 0px;
  margin-left: 10px;
}

.tuo-2 {
  width: 3.5px;
  height: 17px;
  background-color: #4b71bf;
  margin-right: 4px;
  font-size: 12px;
}

.one {
  display: flex;
}

.one-1 {
  margin-left: 20px;
}

.one-2 {
  width: 280px;
  min-height: 500px;
  background-color: #f5f8f9;
  margin: 40px 0 0 20px;
  padding-top: 20px;
  padding-left: 10px;
}

.one-3 {
  margin: auto;
  font-weight: bolder;
  font-size: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-shrink: 0;
  justify-content: space-evenly;
  padding: 0 24px;
}

.five_t {
  font-size: 12px;
  margin-right: 5px;
}

.one-4 {
  width: 260px;
  margin: auto;
  /* background-color: #1435F5; */
  font-size: 12px;
  color: #b0bdc6;
  display: flex;
  margin-bottom: 10px;
}

.one-5-1 {
  width: 240px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  font-weight: bolder;
  margin-bottom: 10px;
}

.one-6-1 {
  width: 230px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.one-5-1-1 {
  margin-top: 5px;
  font-size: 11px;
  font-weight: normal;
  color: #b0bdc6;
  margin-bottom: 10px;
}

.one-7 {
  width: 100%;
  height: 1px;
  border-bottom: 1px solid #b0bdc6;
  margin-bottom: 10px;
}

.one-8-1 {
  width: 240px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 10px;
}
.one-8-8 {
  width: 220px;
  margin-left: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.one-8-2 {
  width: 90%;
  height: 1px;
  margin: auto;
  border-bottom: 1px dashed #b0bdc6;
  margin-bottom: 10px;
}

.one-8-3 {
  display: flex;
  margin-bottom: 10px;
}

.one-8-4 {
  font-size: 12px;
  color: #b0bdc6;
  margin-left: 50%;
  margin-top: 8px;
  text-decoration: underline;
  cursor: pointer;
}

.one-8-5 {
  font-weight: bolder;
  color: #f06f2d;
  font-size: 20px;
}

.one-9-1 {
  margin-top: 20px;
}

.one10 {
  width: 60%;
  margin: auto;
  color: #2a50a2;
  margin-top: 130px;
  font-size: 12px;
  text-decoration: underline;
}

.tww {
  display: flex;
}

.tww-1 {
  margin-top: 10px;
  display: flex;
}

.tww-3 {
  font-size: 10px;
  margin-top: 5px;
  color: #b0bdc6;
}

.tww-3-1 {
  margin-left: 10px;
  text-decoration: underline;
}

.againcheck {
  margin-left: 10px;
}

.two {
  /* height: 120px; */
  background-color: #f5f8f9;
  width: 688px;
}

.four-1 {
  display: flex;
  background-color: #f5f8f9;
  line-height: 38px;
  margin-left: 20px;
}

.three-1 {
  /* height:80%; */
  background-color: #f5f8f9;
  line-height: 37px;
  margin-left: 20px;
}

.three-2 {
  font-size: 12px;
  font-weight: normal;
  /* transform: scale(.4) */
  letter-spacing: -1.1px;
  margin-top: 5px;
}

.three-3-2 {
  font-size: 12px;
  color: #abb9c2;
}

.five-1 {
  background-color: #f5f8f9;
}

.five-2 {
  display: flex;
  align-items: center;
  font-size: 12px;
}

.five-3 {
  display: flex;
  line-height: 42px;
  flex-direction: column;
}

.five-4 {
  display: flex;
  font-size: 12px;
  color: #abb9c2;
  align-items: center;
}

.six-1 {
  background-color: #f5f8f9;
  display: flex;
}

.six-2 {
  font-size: 12px;
  color: #1435f5;
  padding: 0 10px;
}

.seven {
  margin-left: 20px;
}

.seven-1 {
  background-color: #f5f8f9;
  padding-top: 20px;
}

.seven-2 {
  display: flex;
}

.seven-3 {
  display: flex;
  align-items: center;
}

.two-1 {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.eight-1 {
  height: 40px;
  width: 688px;
  padding-top: 10px;
  padding-left: 10px;
  background-color: #f5f8f9;
}

.ten {
  /* margin-left: 20px; */
  margin-top: 30px;
  padding-bottom: 30px;
  float: right;
  margin-right: 40px;
}

.passengers_1 {
  float: right;
  margin-right: 10px;
}

.clk_1 {
  margin-top: 20px;
  width: 100%;
}

.form_ch {
  display: flex;
  flex-wrap: wrap;
  width: 94%;
  justify-content: flex-start;
  margin: 10px 0 0 0;
  flex-direction: column;
}

.clk {
  width: 100px;
  margin: auto;
  margin-left: 50%;
  color: #fff;
  background-color: #f6b23e;
}

.passengers {
  font-size: 12px;
  margin-bottom: 30px;
  padding-top: 0.1px;
}

.passengers .el-form-item {
  display: flex;
}

.radioBox .el-radio__label {
  width: 50vw;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  text-align: left;
}

.el-radio__label p {
  width: 50%;
}

.el-radio__label div {
  margin-right: 20px;
  color: #8c939d;
  text-decoration: underline;
}

.el-checkbox__label {
  display: flex;
}

.radioBox {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.expressBox {
  font-size: 12px;
  height: 220px;
  width: 688px;
  padding-top: 10px;
  padding-left: 10px;
  background-color: #f5f8f9;
}

.express-1 p {
  width: 15vw;
}

.express-2 {
  color: #a6a9ad;
  margin-left: 10px;
  text-decoration: underline;
}

.express-3 {
  width: 97%;
  margin-top: 5px;
  background-color: #fff;
  height: 30px;
  line-height: 30px;
  border-left: #969696 7px solid;
}

.image {
  width: 20px;
  height: 20px;
}

.el-form .five-1 > .el-form-item {
  margin-bottom: 10px !important;
}

.two-1 .el-form-item .el-form-item--mini {
  margin-bottom: 10px !important;
}

.WeChat {
  color: #8aa2ae;
  font-size: 13px;
}

.WeChat1 {
  display: flex;
}

.el-radio__label {
  display: flex;
}

.ch_top {
  display: flex;
  align-items: center;
}

.box1 {
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  white-space: nowrap;
}

.others {
  display: flex;
  flex-direction: column;
  background-color: #f5f8f9;
  padding-top: 20px;
}

.othersed {
  display: flex;
  background-color: #f5f8f9;
  padding-top: 20px;
}

.Query_c {
  display: flex;
}

.three-3-1 {
  padding-left: 20px;
}
</style>